# Comparison for two columns that have text values

1. ## Comparison for two columns that have text values

Hi All,

Hope you are doing well!...I am trying to compare text values in two columns...If the values are same I return 1 otherwise I return 0...But I have problems with the return '0'...I get '0' return values even if ID's are matching...Can you please help with the same...Attached the file...

Thanks,
Arun

2. ## Re: Comparison for two columns that have text values

that is because the one is text and the other is numeric. A36 is numeric and B36 is text. you could change your formula to this and it will work. =IF(A2*1=B2*1,1,0)

EDIT: also not sure how you want row 100 handled where you have 210 and 00210, that formula will make the leading zeros irrelevant and so equal.

3. ## Re: Comparison for two columns that have text values

Hi Sambo,

I want to treat the leading zeros as relevant too... so 210 and 00210 should be treated as different...can you please advice on how i can do that...

Thanks,
Arun

4. ## Re: Comparison for two columns that have text values

this one is a bit more convoluted but treats rows 81 and 100 differently d/t length... =IF(AND(LEN(A2)=LEN(B2),A2*1=B2*1),1,0)
see what you think.

There are currently 1 users browsing this thread. (0 members and 1 guests)