cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
hughrmarks
Helper IV
Helper IV

Referencing data with a function

I am trying to pull the name from an external Excel table (Employees) and can easily do so with this function:

 

Default = lookup(Employees, ID="1").Name

 

However, I have a dropdown (DropdownA) I'm using to select numbers and want to be able to get that same name when I select the number 1 from the dropdown.   I obviously need to change the ID=1 in the formula to reference the value in the dropdown instead but I don't know how.   I tried:

 

Default = lookup(Employees, ID=DropdownA.value).Name

 

but that didn't work.   I have a feeling I'm close....but need help.   Thanks.

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Sienna
Memorable Member
Memorable Member

Ye were nearly there

 

Default = LookUp(Employees, ID=DropdownA.Selected.Value).Name

View solution in original post

It isn't all right because you adding number to a text. What you have to do if you want to do it this way is to format it to number and then back to text

 

Default = LookUp(Employees, ID=Text(Value(DropdownA.Selected.Value + 1))).Name

 

Or you can try to format both ID to number like this

 

Default = LookUp(Employees, Value(ID)=Value(DropdownA.Selected.Value) + 1).Name

View solution in original post

9 REPLIES 9
Shanescows
Super User
Super User

Default = lookup(Employees, ID=DropdownA.value, Name)

 

I think that is it. Don't have to recreate it, I am doing a webinar in 2 minutes. 🙂 You are real close. 

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training
Sienna
Memorable Member
Memorable Member

Ye were nearly there

 

Default = LookUp(Employees, ID=DropdownA.Selected.Value).Name

View solution in original post

Move .Name and use a comma instead.

 

LookUp(Colors, BrowseGallery1.Selected.FavoriteColor = ColourName,ColourName) works in my App. So for you it is:

 

LookUp(Employees, ID=DropdownA.Selected.Value, Name)

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training

Sorry @Sienna in my rush I didn't realize this was your reply I thought you were the original poster. 🙂 Whoops.

 

And I have never done it the way you showed. Very cool, learn something new every day. 

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training

@Shanescows

That is OK 🙂

We answered at the same time

Thanks @Sienna and @Shanescows !

 

@Shanescows- I've watched every Bold Zebra video on PowerApps.   Great job.   Keep them coming!

I wanted to also use the same dropdown to pull the second name from the data souce (ID="2") but the following formula did not work:

 

Default = LookUp(Employees, ID=DropdownA.Selected.Value + 1).Name

 

I gotta figure that the +1 is right but that I'm just missing parenthesis somewhere.

Anyone?

It isn't all right because you adding number to a text. What you have to do if you want to do it this way is to format it to number and then back to text

 

Default = LookUp(Employees, ID=Text(Value(DropdownA.Selected.Value + 1))).Name

 

Or you can try to format both ID to number like this

 

Default = LookUp(Employees, Value(ID)=Value(DropdownA.Selected.Value) + 1).Name

View solution in original post

@Sienna - You're awesome!   Worked great!   That saved me much frustration...

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,138)