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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Lookup not exact value
Power Apps
Answered

Lookup not exact value

(0) ShareShare
ReportReport
Posted on by 24

Hello there, so I have a excel table as data source te hat is something like this:

DIP  LITRES

0       2200

1.      2190

2       2175

..... 

 

I want to the user to type the litres: 2195 for example and the lookup or function return the closest 'Dip'. In excel I can achieve this by using XLookup formula. There is any way to do this in powerapps? 

 

Thanks for the help 

Categories:
I have the same question (0)
  • eka24 Profile Picture
    20,923 on at

    You can use LookUp to achieve that:

     

    LookUp (Table1,Litres=Value(Textbox1.Text),Dip)

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Verified answer
    rubin_boer Profile Picture
    4,841 Super User 2024 Season 1 on at

    Hi @DANIEL13 

     

    part of the search set a min and max number something like:

    Set(_Min,First(Filter(colData, Liters <= Value(TextInput2.Text))).Liters);
    Set(_Max,Last(Filter(colData, Liters >= Value(TextInput2.Text))).Liters);
    Set(_Eval, If((_Min+_Max)/2 > Value(TextInput2.Text),_Min,_Max))

     

    the lookup will then be something like:

    LookUp(colData,Liters=_Eval,Dip)

     

    when 2174 is looked up, 2 is returned

    rubin_boer_0-1612556595670.png

    If 2152 is looked up 3 is returned

    rubin_boer_1-1612556672700.png

     

    hope this will work for you.

     

     
  • DANIEL13 Profile Picture
    24 on at

    Thanks Robin you are a legend. I could not work it out by myself 

  • andrewfmills Profile Picture
    5 on at

    I came across this post as I was searching for how to do a similar task. I couldn't get the suggested solution to work unless I changed the code to:

    Set(_Min,First(Filter(colData, Value(Liters) <= Value(TextInput2.Text))).Liters);

     

    It appears that Powerapps doesn't recognise my data table as being numerical. Any ideas what I'm doing wrong here? I have the format in Excel set as Number rather than General

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard