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 Automate / Concat 2 column to 1 c...
Power Automate
Answered

Concat 2 column to 1 column in first and second excel, then VLOOKUP

(0) ShareShare
ReportReport
Posted on by

Hi, I'm quite new to Power Automate Desktop.

But need help with this situation:

This is the scenario,

I have this Excel1.

IDCompany NameUniqueID
001ABCD

(How to concat ID and Company and become like this?)

001ABCD

002EFGH002EFGH
003IJKL003IJKL

 

Excel 2

IDCompany NameUniqueIDStatus
001ABCD001ABCDMatched
002IJKL002IJKLTransferred
003IJKL003IJKLMatched

 

 

Based on the table: 

1) I need to CONCAT 2 column which is ID and company name into UniqueID column. How to concat the ID and Company and write the value to UniqueID? 

2) After that, I want to vlookup based on the uniqueID in excel 1 and excel 2. If the uniqueID same in excel1 and excel 2, put "Matched" at status column
3) If the unique ID is not same, put "Transferred".

4) For now, the logic is there. But if you have another solution, you can come with it. But the most important is that i want to know how to combine ID and Company Name and write into UniqueID. Is it possible?

Thank you !

I have the same question (0)
  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    You will need to use Read from Excel worksheet to read all of the data from your sheet. Then use Loop to loop from 0 to %ExcelData.RowsCount-1% (assuming you read your data into a variable called %ExcelData%, then %ExcelData.RowsCount% will store the number of rows in the data table, and the minus 1 is needed because loop indexes are 0-based). You will then be able to use Write to Excel worksheet and write the value of %ExcelData[LoopIndex]['ID']%%[ExcelData[LoopIndex]['Company Name']% back to Excel.

     

    Make sure that you set the advanced option to get the first row of data as headers in the Read from Excel worksheet for this to work. And, when you write the Unique Id, back to Excel, make sure you use %LoopIndex+2% as the row to write to. The +2 is needed, because loop indexes are 0-based, as mentioned, and also because you have a header row at row 1 in the file.

     

    The above will solve the "concat" task. 

     

    For the lookup, once you have this done, you can use Find or replace in data table action to search for a value in a table. So, if you have two tables extracted from two Excel files, you need to loop through one of them (again, with a Loop action set up the same way as above) and search for %ExcelData[LoopIndex]['UniqueID']% (assuming you use the same variable names - they might be different at this point, but I hope you get the idea) in the other table. If there are any matches, the result will be a data table with the row and column indexes of where a match was found. You can use a condition to check if %DataTableMatches% is empty. If it is, you know the status should be 'Transferred'. If the matches is not empty, it should be 'Matched'.

     

    You can then write the status back to Excel using Write to Excel worksheet using the same logic as with the IDs.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • nraindmia Profile Picture
    on at

    Hii! It works for the Concat function. But it keeps running even though there's no data. How to make it stop when there's no data to concat? Thank you !

    nraindmia_0-1692507403516.png

     

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Try using Get first free column/row from Excel worksheet and instead of reading all data in Read from Excel worksheet, read a range that starts at column A and row 1, and ends at column %FirstFreeColumn-1% and row %FirstFreeRow-1%.

    Alternatively, you can add a condition inside the loop that checks if a value in one of the columns is empty. If empty, use Exit loop to stop looping.

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

    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

     

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • nraindmia Profile Picture
    on at

    Hii ! thank youu it works now for the Concat. Really appriciate it !
    Now, I have problem at the if condition,

    nraindmia_0-1692578162454.png

    nraindmia_1-1692578200278.png

     I got error for the condition. Do you have any idea what to put in first operand to compare if first excel in column Unique ID is the same as second excel for column UniqueID, i will write as "Matched?"

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    You do not need an AND operator there. Simply put %ExcelData['UniqueID']% in the first operand and %ExcelData2['UniqueID']% in the second operand.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • nraindmia Profile Picture
    on at

    Tried that before but this error prompt:

    nraindmia_1-1692590801875.png

     

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    This is because you need to read your %ExcelData% from Excel again after writing the UniqueID back to Excel. You are using the original data table that did not have the column yet.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • nraindmia Profile Picture
    on at

    Understand, I tried to read the excel again but still got error, then i try to save the previous excel first then read again the excel, but still error. Am i doing it wrong? 

    nraindmia_0-1692591388964.png

     

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Oh, right, you are trying to compare an entire column at once. This will not work. You need to loop through those tables again and compare each row individually.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • nraindmia Profile Picture
    on at

    Can I know how to get it done?

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 246 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 176

#3
Haque Profile Picture

Haque 157

Last 30 days Overall leaderboard