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 / lookup with global var...
Power Apps
Unanswered

lookup with global variable

(0) ShareShare
ReportReport
Posted on by 2

Hello,

I'm new here and also new to powerapps.

I made buttons where you can select your language. The variable "languageuser" is then set to the chosen language. 

In the next screen I want to search the word in the chosen language in my sheet, so that i don't have to make different screens for every language.

So the text of my button on screen2 should be e.g. "dolor" if you chose spanish. So I used lookup(sheet1;english="pain";languageuser). But this gives me the answer "spanish" which is the text of the variable languageuser.

If I use lookup(sheet1;english="pain";spanish) it works perfectly fine and gives me dolor.

I don't understand why there's a difference when languageuser=spanish?

 

Thank you very much,

Alex

Categories:
  • eka24 Profile Picture
    20,925 on at

    The difference is that:

    languageuser is not a column in your table

    spanish? is a column in your Table.

     

    Can you explain further. If possible show table columns

     

    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.

     

  • alex13 Profile Picture
    2 on at

    Thank you for your answer!

    I attached some screenshots.

    I just wonder why it works when i write "espagnol" but when i use languageuser which is set to "espagnol" it doesn't work.

    Is there any solution to it?

     

    The main goal is to make the text of the buttons depending on the language you chose before, so that i dont have to make a new screen for every language someone might choose.

     

    I hope that it is more clear now.

    doesnt work.JPG
    sheet1.JPG
    Works.JPG
  • timl Profile Picture
    37,287 Super User 2026 Season 2 on at

    Hi Alex

    Welcome to the forums and to PowerApps.

    With the Lookup function, it isn't possible to refer to a column name with a variable.

    A workaround would be to use the switch function like so:

    Switch(languageuser
     espagnol;
     LookUp(sheet1;english="pain";espagnol)
     francais;
     LookUp(sheet1;english="pain";francais)
    )
    
    

     

    There's a post in the ideas forum about this that you can vote on.

    https://powerusers.microsoft.com/t5/Power-Apps-Ideas/LookUp-function-reference-column-name-by-a-global-variable-A/idi-p/315548 

    To clarify the way that the LookUp function works, the third argument defines a formula that returns a single value output.

    For example, you could write a formula that looks like this:

    LookUp(sheet1;
     english="pain";
     "Spanish:" & espagnol & ", French:" & francais
    )
    
    

    Given your spreadsheet, this would produce the following result:

    Spanish:dolor, French: fgj

    By extension of this logic, hopefully you can see that if languageuser is a variable that is set to espagnol, the following function would produce 'espagnol'.


    LookUp(sheet1;english="pain";languageuser )

     

    Let us know if you require any further clarification.

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
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard