Please need help to Get the different between 2 columns in Excel sheet

i have excel sheet and inside it i have 2 columns need to compare this 2 and get the different value in new excel sheet
Please need support

Hi @Mabbas

Please refer the below links:

1 Like

Hi Mabbas,

1.Read the excel sheet to a datatable and build a new datatable to store the distinct values.
2. Use the condition “row(0).ToString <> row(1).ToString” to compare the first 2 columns and find the distinct values.
3.Assign the row values to a new datatable which satisfies the condition.
4. Write the new datatable to an excel file.

Warm Regards,
Nimin

1 Like

Hi nimin

Thanks for your support
please if you have (xaml) could you share with me to check the code i try but it’s not working

thanks dear

Hi Mohamed,

Please check the attached workflow.
Different_Values.xaml (10.9 KB)

Warm Regards,
Nimin

1 Like

Main.xaml (10.3 KB)
Hi Nimin
can you check my code please there is a issue in For Each row

thanks for your support

Hi Mohamed,
You can write individual values to a new excel file by using “Write Cell” activity instead of “Write Range” activity.:slightly_smiling_face:
Please go through the workflow.Mainmhmd.xaml (12.9 KB)

Warm Regards,
Nimin

1 Like

Hi Nimin

realy thanks for your support not it’s working but still i got error we start the code and also what should the code to get the value not matching like (cint(row(0)) = cint(row(1))) this code if row 0 equel row 1 what the code if not equel because i try ( <> , != and !==) but it’s not working

Kindly check my code and excel sheet thanks dear for your support

Main.xaml (12.8 KB)
Vlookup.xlsx (9.0 KB)

error code

Hi Mohamed,
This error is due to the comparison of an integer value with a null value. You can get rid of this issue by converting the cell value to string. Please use the condition “row(0).ToString = row(1).ToString” in the if activity. :grinning:

Warm regards,
Nimin

1 Like

Hi Mohamed,
Also you can extract the distinct values by using the condition “row(0).ToString <> row(1).ToString”

Thank you.

1 Like

Thanks dear for your help :grinning:

Hi Nimin
i have one more question now when utry this code with my data i found the data in colum 1 should match colum 2 i mean sort like the excel sheet send to you but if i want search value from column 1 in column 2 and if i found this value it’s ok if i don’t found it i need to copy in different column
like this excel

thanks dear for your support

Main.xaml (13.2 KB)
Vlookup.xlsx (9.1 KB)

Hi Mohamed,
I don’t get your requirement exactly. What I understand is, If the first 2 columns does not matches, you need to write these columns in an excel file, like what is in your attached workflow now. Likewise, you also need to write the mismatched items in that excel file. Is it right? If so, just write the matched cell values to the excel file in the ‘else’ section of the ‘if activity’. Please refer the screenshot. Create a new counter variable(int32) to hold the row index.
In the range value of the ‘write cell’ activity, use ’ “C”+ counter.ToString ’ and ’ “D”+ counter.ToString’ to start writing the values on C & D Columns.

Warm Regards,
Nimin

i mean now in column 1 you will find number 1 and also you will find the same number in column 2 that mean in both column i have this number that mean i don’t want this value , and now like number 20 i have this in column 1 but i don’t have it in column 2 that mean i want this value and this the diffrent between column 1 and 2

thanks dear for your support

i hope this phote expline my issue now

C0CA2B2F-5748-4184-8BA9-0CB98981F027

Hi Mohamed,

Please check the workflow. I hope it will meet your requirement.:grinning:
Main2_abs.xaml (13.3 KB)

Warm regards,
Nimin

1 Like

Thanks Thanks Thanks dear yeah now working as i want thanks for your support
:grinning:

1 Like

Hi nimin

Realy thanks for your help and support me

please dear i have question not if i want to delete value satart with (P OR S) form column could you check my Xaml code because that i face issue in assin
B149F0DA-B98F-4E2D-A669-AEB9BF9C61B1

Main.xaml (8.5 KB)

thanks dear for your help

Hii Mohamed,

Please go through this workflow. Remove_Conditional_Row.xaml (10.8 KB)
This will remove rows containing in the “Result” column, in which the cell starts with P or S. :slightly_smiling_face:

Warm Regards,
Nimin