Excel String Comparison Macro

ramalvi

New Member
Joined
Jan 13, 2019
Messages
1
hi,

[TABLE="width: 458"]
<colgroup><col span="2"><col><col span="2"><col><col></colgroup><tbody>[TR]
[TD]Charge[/TD]
[TD]Currency[/TD]
[TD]Collector[/TD]
[TD][/TD]
[TD="colspan: 3"]Correct Data[/TD]
[/TR]
[TR]
[TD]XNG[/TD]
[TD]BRL[/TD]
[TD]LIBRAN10[/TD]
[TD][/TD]
[TD]XNG[/TD]
[TD]BRL[/TD]
[TD]LIBRAN8[/TD]
[/TR]
[TR]
[TD]XNG[/TD]
[TD]USD[/TD]
[TD]LIBRAN10[/TD]
[TD][/TD]
[TD]THD[/TD]
[TD]BRL[/TD]
[TD]LIBRAN10[/TD]
[/TR]
[TR]
[TD]XNG[/TD]
[TD]BRL[/TD]
[TD]LIBRAN7[/TD]
[TD][/TD]
[TD]THD[/TD]
[TD]USD[/TD]
[TD]LIBRAN7[/TD]
[/TR]
[TR]
[TD]XNG[/TD]
[TD]BRL[/TD]
[TD]LIBRAN8[/TD]
[TD][/TD]
[TD]DDF[/TD]
[TD]BRL[/TD]
[TD]LIBRAN10[/TD]
[/TR]
[TR]
[TD]THD[/TD]
[TD]BRL[/TD]
[TD]LIBRAN10[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]THD[/TD]
[TD]BRL[/TD]
[TD]LIBRAN7[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]THD[/TD]
[TD]USD[/TD]
[TD]LIBRAN10[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]THD[/TD]
[TD]USD[/TD]
[TD]LIBRAN7[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]DDF[/TD]
[TD]BRL[/TD]
[TD]LIBRAN10[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]DDF[/TD]
[TD]BRL[/TD]
[TD]LIBRAN6[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

This is a excel format.
right side data is correct data ok, i need to compare and show output.
if XNG=BRL=LIBRAN8 means need to show near column as "No Error".
else show near column as "Error"
This can be done whole column and right side data is correct data.
Please create and send me a excel macro code.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Is a formula solution acceptable? If so, try...

A1:H11

[TABLE="width: 800"]
<tbody>[TR]
[TD="class: xl63, width: 64"]Charge[/TD]
[TD="class: xl63, width: 64"]Currency[/TD]
[TD="class: xl63, width: 64"]Collector[/TD]
[TD="class: xl63, width: 64"][/TD]
[TD="class: xl63, width: 64"]Correct Data[/TD]
[TD="class: xl63, width: 64"][/TD]
[TD="class: xl63, width: 64"][/TD]
[TD="class: xl63, width: 64"][/TD]
[/TR]
[TR]
[TD="class: xl63"]XNG[/TD]
[TD="class: xl63"]BRL[/TD]
[TD="class: xl63"]LIBRAN10[/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"]XNG[/TD]
[TD="class: xl63"]BRL[/TD]
[TD="class: xl63"]LIBRAN8[/TD]
[TD="class: xl63"]No Error[/TD]
[/TR]
[TR]
[TD="class: xl63"]XNG[/TD]
[TD="class: xl63"]USD[/TD]
[TD="class: xl63"]LIBRAN10[/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"]THD[/TD]
[TD="class: xl63"]BRL[/TD]
[TD="class: xl63"]LIBRAN10[/TD]
[TD="class: xl63"]No Error[/TD]
[/TR]
[TR]
[TD="class: xl63"]XNG[/TD]
[TD="class: xl63"]BRL[/TD]
[TD="class: xl63"]LIBRAN7[/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"]THD[/TD]
[TD="class: xl63"]USD[/TD]
[TD="class: xl63"]LIBRAN7[/TD]
[TD="class: xl63"]No Error[/TD]
[/TR]
[TR]
[TD="class: xl63"]XNG[/TD]
[TD="class: xl63"]BRL[/TD]
[TD="class: xl63"]LIBRAN8[/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"]DDF[/TD]
[TD="class: xl63"]BRL[/TD]
[TD="class: xl63"]LIBRAN10[/TD]
[TD="class: xl63"]No Error[/TD]
[/TR]
[TR]
[TD="class: xl63"]THD[/TD]
[TD="class: xl63"]BRL[/TD]
[TD="class: xl63"]LIBRAN10[/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[/TR]
[TR]
[TD="class: xl63"]THD[/TD]
[TD="class: xl63"]BRL[/TD]
[TD="class: xl63"]LIBRAN7[/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[/TR]
[TR]
[TD="class: xl63"]THD[/TD]
[TD="class: xl63"]USD[/TD]
[TD="class: xl63"]LIBRAN10[/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[/TR]
[TR]
[TD="class: xl63"]THD[/TD]
[TD="class: xl63"]USD[/TD]
[TD="class: xl63"]LIBRAN7[/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[/TR]
[TR]
[TD="class: xl63"]DDF[/TD]
[TD="class: xl63"]BRL[/TD]
[TD="class: xl63"]LIBRAN10[/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[/TR]
[TR]
[TD="class: xl63"]DDF[/TD]
[TD="class: xl63"]BRL[/TD]
[TD="class: xl63"]LIBRAN6[/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"]


[/TD]
[/TR]
</tbody>[/TABLE]
H2, confirmed with CONTROL+SHIFT+ENTER, and copied down:

=IF(ISNUMBER(MATCH(E2&"#"&F2&"#"&G2,$A$2:$A$11&"#"&$B$2:$B$11&"#"&$C$2:$C$11,0)),"No Error","Error")

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,200
Members
453,022
Latest member
RobertV1609

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top