cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GenericoName
Helper II
Helper II

Using value from Excel table in an if statement

Hi everybody,

 

How would I go about checking to see if a value from an excel table and a text input in my powerapp match? I have a page full of text inputs that patches them into a new row in the Excel document when the submit button is pressed, but how could I rig the submit button to patch an existing row if the first text input is identical to one in the table?

1 ACCEPTED SOLUTION

Accepted Solutions

@GenericoName Try this (remember to change table and column names as applicable),

With({varMatchingRecord:LookUp(excelTable, matchColumn=textInput.Text)}
Patch(excelTable, If(IsBlank(varMatchingRecord), Defaults(excelTable), varMatchingRecord), {values to patch})
)

 

Please remember to give a 👍 and accept the solution as it will help others in the future.

 

View solution in original post

5 REPLIES 5
CNT
Super User
Super User

@GenericoName Try this (remember to change table and column names as applicable)

Patch(excelTable, LookUp(excelTable, matchColumn=textInput.Text), {values to patch})

This works for patching existing rows if the value matches up, but is it possible to create a new row with the same button if the value does not match something in the table?

@GenericoName Try this (remember to change table and column names as applicable),

With({varMatchingRecord:LookUp(excelTable, matchColumn=textInput.Text)}
Patch(excelTable, If(IsBlank(varMatchingRecord), Defaults(excelTable), varMatchingRecord), {values to patch})
)

 

Please remember to give a 👍 and accept the solution as it will help others in the future.

 

Worked perfectly, thank you!

@GenericoName Glad to help!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,397)