+ Reply to Thread
Results 1 to 4 of 4

Formula too long - Shorter version?

  1. #1
    Registered User
    Join Date
    04-14-2006
    Posts
    16

    Formula too long - Shorter version?

    I am trying to put a check into a worksheet that look down a list of concatenated items and if a duplicate appears it tells me, if not it says ok. As entries are made into the datasheet it needs to be checked against the rest of the items in the list to see if it has a duplicate. There is a possibility 100 concatenated items in the list. I figured out i can do this with if statements within if statements, this works but the formula gets too long and eventually isnt allowed. I need to shorten the formula but dont know how. This is a working formula i am using

    =IF(AG5=AG4,"Duplicate",IF(AG5=AG6,"Duplicate",IF(AG5=AG7,"Duplicate","OK")))

    Basically each time an entry is made into the sheet the entries are concatenated in a column, the sheet then needs to check with all concatenated items in that list above and below it, but not itself. If a its a duplicate this would be returned in the cell beside the item, if its not its ok, for every entry that is made. Clear as mud i know.

    Please help

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,697
    Try

    =IF(COUNTIF(AG$4:A$G100,AG5)>1,"Duplicate","OK")

  3. #3
    Registered User
    Join Date
    04-14-2006
    Posts
    16

    Bang On

    You're a genius, i have no idea what that does but it works exactly how i want, thankyou

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,697
    I notice I put one of the dollar signs in the wrong place but

    COUNTIF(AG$4:AG$100,AG5)

    counts the number of occurrences of AG5 within the range AG4:AG100. In this case because AG5 is part of the range the answer must be at least 1, however if the result is more than 1 that means you have a duplicate.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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