Compare between 2 excels and find the similarity

Hi everyone, I have 2 excel sheets. 1 containing customer data like name, email address and favourite artist. While the other is the list of artist. I was wondering how I could compare the 2 excel sheets to check if a customer’s favourite artist is in the artist list and if it does, prompt a message box saying ‘(customer name) favourite artist, (artist name), is in our list’

I have tried using a for loop but I got confused how I could get the variables out of the excel sheet and properly promt the message box with the required variables. Any help is appreciated !

Hi @jhong

→ Use the read range workbook activity to read the First excel which the Customer data and favourite list and store the output in dt1.
→ Use another read range workbook activity to read the Second excel which has the list of artist names and store the output in dt2.
→ Take an assign activity and create a List of String variable called List_Artists.

- Assign -> List_Artists = dt2.AsEnumerable().Select(Function(row) row.Field(Of String)("Artist")).ToList()

→ After assign insert an for each row in datatable activity to iterate the each row in the dt1.
→ Inside for each insert If activity to check the condition.

- Condition -> List_Artists.Contains(CurrentRow("favourite artist"))

→ In then block insert an message activity and give as below,

Currentrow("Customer name").toString+" favourite artist is listed in our artist list"

Hope it helps!!

You can check the below workflow for better understanding,

2024.xaml (20.1 KB)

Input Excel -
The First excel is in the Sheet1 and Second excel is in the Sheet2.

Demo Data.xlsx (10.5 KB)

Output -

I’ve just tried it out and yes it worked! Thank you so much for your help

It’s my pleasure… @jhong

Happy Automation!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.