+ Reply to Thread
Results 1 to 6 of 6

IF-THEN Check four values to see if there is a match

  1. #1
    Registered User
    Join Date
    01-12-2020
    Location
    Philadelphia, PA
    MS-Off Ver
    2016
    Posts
    97

    IF-THEN Check four values to see if there is a match

    Hi, all!

    So what I want to do is determine if there is a match between 4 values.

    For example, what I TRIED is =IF(A1<>B2<>C2<>D2,"Unique","Duplicate")

    So, therefore, assuming the four values are all unique, I would get "Unique", but if any one of the four matched any one of the others, it would return "Duplicate". However, Excel doesn't seem to like my way of doing it.

    I have tested it with only two values and it worked fine, but it fails if I add a third. What am I doing wrong?

    Thanks!

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: IF-THEN Check four values to see if there is a match

    That is invalid syntax. A given comparison operator can only have two operands; you can't chain them. You have to do six separate comparisons.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,098

    Re: IF-THEN Check four values to see if there is a match

    If A1 is a typo & should be A2, you could also use
    =IF(SUM(COUNTIF(A2:D2,A2:D2))>4,"Duplicate","Unique")

  4. #4
    Registered User
    Join Date
    01-12-2020
    Location
    Philadelphia, PA
    MS-Off Ver
    2016
    Posts
    97

    Re: IF-THEN Check four values to see if there is a match

    Thank you both!
    Yes, I made a typo. All of the values to compare are on the same row.

    Fluff13, yours is easier, but it doesn't seem to work. It seems like I can't compare a Range to another Range... in each case, =SUM(COUNTIF(A2:D2,A2:D2)) gives me a result of 0.
    6StringJazzer's answer will work, but it would be more difficult if I added more columns. What if I wanted to compare 7 or 8 values? That would be way too messy.

  5. #5
    Registered User
    Join Date
    01-12-2020
    Location
    Philadelphia, PA
    MS-Off Ver
    2016
    Posts
    97

    Re: IF-THEN Check four values to see if there is a match

    Ok, found it!

    You were close, Fluff13! I Googled it a little further, and I found this:

    =SUM(IF(FREQUENCY(G2:L2,G2:L2)>0,1))

    Thank you both. I will still Upvote you both for the quick responses!

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,098

    Re: IF-THEN Check four values to see if there is a match

    Glad you sorted it & forgot to mention that with my solution it probably needs CTRL Shift Enter rather than just Enter

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Finding Match and Paste Values, Script - Not Working; Can someone please check
    By NametobeRenamed in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-26-2019, 06:16 PM
  2. Check to see if all values in row match any rows in a separate range
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-29-2018, 10:07 AM
  3. [SOLVED] Cross Check Columns for Index Match Match
    By Harr in forum Excel Formulas & Functions
    Replies: 25
    Last Post: 12-31-2015, 11:35 AM
  4. possible to check for file in multiple folders, then check for values in specific cells?
    By mattheritage in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-04-2014, 08:33 AM
  5. [SOLVED] Check if Cell Contains any values from a list, partial match
    By scottclayton in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-22-2013, 05:39 AM
  6. [SOLVED] Match up 2 lines to their values in a table and check condition.
    By stockgoblin42 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-26-2013, 10:52 AM
  7. Check if a set of values match
    By JungleJme in forum Excel General
    Replies: 3
    Last Post: 04-13-2010, 03:22 PM

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