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 Automate / VLOOKUP, XLOOKUP or IN...
Power Automate
Unanswered

VLOOKUP, XLOOKUP or INDEX MATCH on two columns using Power Automate Flow

(0) ShareShare
ReportReport
Posted on by 159

Hi,

Is there any way to create something similar to a VLOOKUP, XLOOKUP or INDEX MATCH on two columns by using Power Automate Flow (or perhaps SharePoint Lists)?

 

I have way too many rows to use the conditioning tool in flow, unless I can make it dynamic in a way? Or there is another better component?

 

Here is a small example of my problem - but remember, I have so many rows that everything needs to be dynamic!

 

I have this SharePoint list, List1:

blinabj_0-1676363407980.png

 

And I have this SharePoint list, List2, (this one can be in Excel if that is better):

blinabj_2-1676364096951.png

 

Then based on the color and toy in List1, I need to get their favorite candy from List2, so that it ends up looking like this:

blinabj_1-1676363546856.png

 

Note! Their favorite candy is decided based on both their favorite color and toy.

 

I really appreciate the help!

Categories:
I have the same question (0)
  • Verified answer
    Chriddle Profile Picture
    8,436 Super User 2025 Season 2 on at

     

    Chriddle_0-1676376267127.png

    Select

    From: @{outputs('Person')}

    Map:

    addProperty(
    	item(),
    	'Favorite candy',
    	first(
    		xpath(
    			xml(json(concat('{"root":{"item":', outputs('Candy'),'}}'))),
    			concat(
    				'//item[Favorit_x0020_color="',
    				item()['Favorit color'],
    				'" and Favorit_x0020_toy="',
    				item()['Favorit toy'],
    				'"]/Favorite_x0020_candy/text()'
    			)
    		)
    	)
    )

    Outputs:

    [
     {
     "PersonID": 1,
     "Name": "Nora",
     "Favorit color": "Pink",
     "Favorit toy": "Cars",
     "Favorite candy": "Chocolate"
     },
     {
     "PersonID": 2,
     "Name": "Tim",
     "Favorit color": "Green",
     "Favorit toy": "Lego",
     "Favorite candy": "Gummi worms"
     },
     {
     "PersonID": 3,
     "Name": "Kim",
     "Favorit color": "Pink",
     "Favorit toy": "Lego",
     "Favorite candy": "Sour patch kids"
     }
    ]

     

     

  • blinabj Profile Picture
    159 on at

    Thank you so much @Chriddle ! This is exactly what I need, but for some reason it doesn't work when I get the data from SharePoint lists (I get "null"). Do you understand why it doesn't work and what I can do?

     

    This is my flow:

    blinabj_0-1676382449608.png

    blinabj_2-1676382726032.png

     

    blinabj_1-1676382595553.png

     

     

  • Chriddle Profile Picture
    8,436 Super User 2025 Season 2 on at

    Hard to say 😉

    Can you add a Compose with expression

    xml(json(concat('{"root":{"item":', outputs('Candy'),'}}')))

    at the end of your flow and share the output? 

  • blinabj Profile Picture
    159 on at

    @Chriddle, thanks for helping me! The output is:

     

    <root><item><Favorit_x0020_candy>Chocolate</Favorit_x0020_candy><Favorit_x0020_color>Pink</Favorit_x0020_color><Favorit_x0020_toy>Cars</Favorit_x0020_toy></item><item><Favorit_x0020_candy>Chocolate</Favorit_x0020_candy><Favorit_x0020_color>Pink</Favorit_x0020_color><Favorit_x0020_toy>Teddy bears</Favorit_x0020_toy></item><item><Favorit_x0020_candy>Sour patch kids</Favorit_x0020_candy><Favorit_x0020_color>Pink</Favorit_x0020_color><Favorit_x0020_toy>Lego</Favorit_x0020_toy></item><item><Favorit_x0020_candy>Sour patch kids</Favorit_x0020_candy><Favorit_x0020_color>Yellow</Favorit_x0020_color><Favorit_x0020_toy>Cars</Favorit_x0020_toy></item><item><Favorit_x0020_candy>Sour patch kids</Favorit_x0020_candy><Favorit_x0020_color>Yellow</Favorit_x0020_color><Favorit_x0020_toy>Lego</Favorit_x0020_toy></item><item><Favorit_x0020_candy>Gummy worms</Favorit_x0020_candy><Favorit_x0020_color>Yellow</Favorit_x0020_color><Favorit_x0020_toy>Teddy bears</Favorit_x0020_toy></item><item><Favorit_x0020_candy>Gummy worms</Favorit_x0020_candy><Favorit_x0020_color>Green</Favorit_x0020_color><Favorit_x0020_toy>Lego</Favorit_x0020_toy></item><item><Favorit_x0020_candy>Lolly pop</Favorit_x0020_candy><Favorit_x0020_color>Green</Favorit_x0020_color><Favorit_x0020_toy>Cars</Favorit_x0020_toy></item><item><Favorit_x0020_candy>Lolly pop</Favorit_x0020_candy><Favorit_x0020_color>Green</Favorit_x0020_color><Favorit_x0020_toy>Teddy bears</Favorit_x0020_toy></item><item><Favorit_x0020_candy>Lolly pop</Favorit_x0020_candy><Favorit_x0020_color>Blue</Favorit_x0020_color><Favorit_x0020_toy>Cars</Favorit_x0020_toy></item><item><Favorit_x0020_candy>Snickers</Favorit_x0020_candy><Favorit_x0020_color>Blue</Favorit_x0020_color><Favorit_x0020_toy>Teddy bears</Favorit_x0020_toy></item><item><Favorit_x0020_candy>Snickers</Favorit_x0020_candy><Favorit_x0020_color>Blue</Favorit_x0020_color><Favorit_x0020_toy>Lego</Favorit_x0020_toy></item></root>
     
    blinabj_0-1676387887671.png

     

  • Chriddle Profile Picture
    8,436 Super User 2025 Season 2 on at

    My bad, I spelled "Favorite candy" (in Candy and in Select's Map). 😞

    Fixed Select's Map for your data:

     

     

     

    addProperty(
    	item(),
    	'Favorit candy',
    	first(
    		xpath(
    			outputs('Xml'),
    			concat(
    				'//item[Favorit_x0020_color="',
    				item()['Favorit color'],
    				'" and Favorit_x0020_toy="',
    				item()['Favorit toy'],
    				'"]/Favorit_x0020_candy/text()'
    			)
    		)
    	)
    )

     

     

     

     

     

  • blinabj Profile Picture
    159 on at

    Thank you so much for all the help @Chriddle ! My mistake to misspell it in the first place 😅

  • ShineTan123 Profile Picture
    213 on at

    Hi @blinabj,

    Would you mind sharing the detail of your coding? I have the same problem as had. 

    I read through the post but I don't know which are using the hard coded which are using dynamic content, for example, these should come from dynamic content? Hope to get your reply. Thanks!

    item()['Favorit color'],
    				'" and Favorit_x0020_toy="',

     

    addProperty(
    	item(),
    	'Favorit candy',
    	first(
    		xpath(
    			outputs('Xml'),
    			concat(
    				'//item[Favorit_x0020_color="',
    				item()['Favorit color'],
    				'" and Favorit_x0020_toy="',
    				item()['Favorit toy'],
    				'"]/Favorit_x0020_candy/text()'
    			)
    		)
    	)
    )

     

  • blinabj Profile Picture
    159 on at

    Hi @ShineTan123 ,

     

    This is the code I am currently using: 

     

    addProperty(

        item(),

        ' Salary',

        first(

            xpath(

                xml(json(concat('{"root":{"item":', outputs('Salary'),'}}'))),

                concat(

                    '//item[JobTitle="',

                    item()['JobTitle'],

    '" and City="',

                    item()['City'],

                    '" and Department="',

                    item()['Department'],

                    '"]/Salary/text()'

                )

            )

        )

    )

     

    You must edit anything in bold to your needs.

    This is a double index match that looks at both City and Department.

     

    This is how my flow looks:

    blinabj_1-1703668562529.png

     

    blinabj_0-1703668442056.png

     

    Hope this helps😊

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 Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard