+ Reply to Thread
Results 1 to 4 of 4

Comparison for two columns that have text values

  1. #1
    Forum Contributor
    Join Date
    10-18-2016
    Location
    Chicago, USA
    MS-Off Ver
    2010
    Posts
    100

    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
    Attached Files Attached Files

  2. #2
    Forum Expert Sambo kid's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    Office 365 ProPlus - work; 2012 for Mac at home
    Posts
    6,172

    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.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Forum Contributor
    Join Date
    10-18-2016
    Location
    Chicago, USA
    MS-Off Ver
    2010
    Posts
    100

    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. #4
    Forum Expert Sambo kid's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    Office 365 ProPlus - work; 2012 for Mac at home
    Posts
    6,172

    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.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1