web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Trying to update a cel...
Power Apps
Unanswered

Trying to update a cell with it's column decided in a switch

(1) ShareShare
ReportReport
Posted on by 2

I am having difficulty updating a table in excel using the patch() function because the column of the cell I am referencing is chosen in a switch. Read below for full context.

 

My department has an excel sheet that we use as a calendar for WFH scheduling. I am trying to make an app that updates the status for a selectable worker on a selectable day. Below is my progress so far.

 

This is 'Table1' which is the excel table I am referencing

danielboesing_0-1691598849868.png

 

Screen 1 has you select a worker and a date to see/update their status.

danielboesing_1-1691599055918.png

 

BELOW IS WHERE I AM HAVING MY ISSUE

danielboesing_2-1691599169374.png

I want the 'Submit' button to update the cell at row 'SelectedDate' and column 'SelectedTeamMember' with the value of the status chosen in the dropdown menu. Since 'Team Member' is not it's own column, I have to use the switch() function to tell powerapps what column to go to. I think I have a syntax error trying to make the 'update' entry in the patch() function vary for each possible TeamMember in switch(). Any ideas or clarifications I can provide?

 

 

 

 

Categories:
I have the same question (0)
  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @danielboesing 
    If there's no red squiggle or any error, you don't have any syntax error. I also checked and it seems like your formula is correct. It's likely something with the LookUp and the Date. 
    Try this: 

     

    If(
     IsBlank(LookUp(Table1, Date = Text(SelectedDate))),
     Notify("Date not found!", NotificationType.Error),
     Patch(
     Table1,
     LookUp(Table1, Date = Text(SelectedDate)),
     Switch(
     SelectedTeamMember,
     "Matt Puffer", {'Matt Puffer': Dropdown2.Selected.Status},
     "Justin Roehm", {'Justin Roehm': Dropdown2.Selected.Status}
     // Continue with the other 7 or 8 users
     )
     )
    )
    

     

    if it says Date not found, check on your LookUp to see if there's anything incorrect about SelectedDate, the column, that you're picking a Date for which exactly one record exists in Table 1, etc. @danielboesing 


    Note: To avoid repeating the same LookUp twice, use With like below:

     

    With(
     {wSelectedDateRecord: LookUp(Table1, Date = Text(SelectedDate))},
     If(
     IsBlank(varSelectedDateRecord),
     Notify("Date not found!", NotificationType.Error),
     Patch(
     Table1,
     wSelectedDateRecord,
     Switch(
     SelectedTeamMember,
     "Matt Puffer", {'Matt Puffer': Dropdown2.Selected.Status},
     "Justin Roehm", {'Justin Roehm': Dropdown2.Selected.Status}
     // Continue with the other 7 or 8 users
     )
     )
     )
    )
    

     

  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @danielboesing,

     

    Could you remove the enclosing curly brackets around the Switch() statement, since you already provide the brackets within the Switch value itself.

     

    Patch(
     DataSource,
     Defaults(Datasource),
     Switch(
     Condition,
     Case1,
     {'Column Name': "TextValue"}
     )
    )

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @LaurensM Yes, that's a very important detail.
    @danielboesing Yes, even with no syntax error, the detail brought up by @LaurensM is very important as it may not work correctly like you have it.
    You are already in record scope, so you should either omit the outer curly braces or the inner ones. Since there's more inner braces, eliminating the inner would be better at reducing more repetition, and keeping only the outer curly braces, but if it really doesn't work you may resort to only eliminating the outer curly braces and keeping the inner ones instead.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#2
11manish Profile Picture

11manish 205 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard