How to compare two columns data in same excel sheet and write the status

I have one excel sheet with two columns. I need to compare Column “A” to Column “B”. Which data matches, need to write status in Column “C” as “Matched” otherwise “Not Matched”. Please help with sample workflow.Book1.xlsx (11.0 KB)

Hi @khan,

Here is the sample workflow for you.

Match Columns in Excel.zip (29.9 KB)

Cheers,

Hi Allen,

In which version, you developed this code. Not able to open I am using 18.4.1

Hi @khan

I am using the latest community version.

Please try remove the project.json file first then open the main.xaml file.

Cheers

Fantastic … Thanks a lot Allen.

Small query, Can I match only starting 3 words and need to ignore 4th one (“Tool”) from each cell. How to do this in same code, please help.Book1.xlsx (11.1 KB)

Small query, Can I match only starting 3 words and need to ignore 4th one (“Tool”) from each cell. How to do this in same code, please help
Book1.xlsx (11.1 KB)

Hi @khan

Use read range and try to do it based on substring

Thanks
Ashwin S

Hi Ashwin,

Would it be something “Substring(0,8)” ? Requesting you to please implement the same in above code.

Hi @khan,

Unsure I understand your question clearly, If the 4th word gonna always be “Tool”, you can use “Matches” activity with regex pattern and assign the match result to a string then compare it.

Here is a quick sample similar as previous, but this use Is Match activity to check if the string (data_1 and data_2) is only letters, if it’s only letters, get all letters before “Tool” and assign to data1 and data2 variables, if both or one of them are not only letters, will just assign data_1 and data_2 to the data1 & data2 variables for compare.

So if you are sure the strings that you want to compare always before one same keyword “Tool” then you can use above method, if always gonna be before the 4th word, you will need to find using different regex pattern.
Match Columns in Excel_2.zip (31.2 KB)

Cheers,

Hi @Allenliaw\Khan

Check this

StrOutput.ToString.Substring(15,4)

Thanks
Ashwin S

No Allen, String will be not always same. We need to check the matches till 12 string. So it should be check only starting 12 (words) or string which can be number or text and need to ignore after 12 string for each cell.

Hi @khan,

Please see the below regex.

This new sample should meet what you need.
Currently the regex pattern in assign checking the first 3 words.
“^(\w+\W+|$){3}”
E.g. “This is UiPath” Tool
You just need to change the 3 to 12 then it will return the first 12 words for doing matching.

If you want to check the first 12 characters.
E.g. “This is UiPa” th Tool
You can assign the value to String.Substring(0,12)

Match Columns in Excel_3.zip (30.9 KB)

Cheers,

Thanks a lot Allen

No worries, hope it helped.