+ Reply to Thread
Results 1 to 6 of 6

Formula to only show multiple occurances only once

  1. #1
    Registered User
    Join Date
    10-05-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Formula to only show multiple occurances only once

    Hi all,

    I am in search of a formula which will extract the name of a supplier, which appears multiple times in a list, only once.

    Please have a look at the attached file if you are interested in helping.

    Many thanks

    Raidon
    Attached Files Attached Files

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Formula to only show multiple occurances only once

    hi Raidon, try copying this into the formula bar of I18:
    =IFERROR(INDEX($B$12:$B$42,MATCH(0,COUNTIF($H$17:H17,$B$12:$B$42),0)),"")

    press CTRL + SHIFT + ENTER to confirm

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,944

    Re: Formula to only show multiple occurances only once

    try this. in H12:H42, use this..
    =IF(B12=B11,"",1+MAX($H$11:H11))

    then in I18 down, use this...

    =IFERROR(INDEX($B$12:$H$42,MATCH(ROW(A1),$H$12:$H$42,0),1),"")
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    10-05-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Formula to only show multiple occurances only once

    Thank you both for your attempts.

    FDibbins, your solution is very close, but not quite right, since the suppliers listed is not listed alphabetically, but listed in the order that they were originally entered unto the spreadsheet. Therefore your formula has a slight flaw if a supplier appears later in the list.

    benishiryo, your array-formula seems to work, but only for the first supplier in the list. Also, I don't completely understand your formula. Why is the COUNTIF part searching for entries in column H, since column H does not contain any information or formulas?

  5. #5
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Formula to only show multiple occurances only once

    sorry, change it to column I instead. i did a test using column H previously.
    =IFERROR(INDEX($B$12:$B$42,MATCH(0,COUNTIF($I$17:I17,$B$12:$B$42),0)),"")

    the COUNTIF will give you a bunch of 0s in the 1st place because i'm counting if I17 (a blank cell) appeared in column B. the results is:
    {0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0}
    so the MATCH of lookup_value "0" gives you the 1st position, which is "Itelligence"

    the COUNTIF in I18 will now count if I17 & I18 appeared in column B. the results is:
    {1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0}
    so it appeared twice & the "0" now is in the 2nd position. hence it returns "Genoa Metal Terminal" now.

    does that help?

  6. #6
    Registered User
    Join Date
    10-05-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Formula to only show multiple occurances only once

    Quote Originally Posted by benishiryo View Post
    sorry, change it to column I instead. i did a test using column H previously.
    =IFERROR(INDEX($B$12:$B$42,MATCH(0,COUNTIF($I$17:I17,$B$12:$B$42),0)),"")

    the COUNTIF will give you a bunch of 0s in the 1st place because i'm counting if I17 (a blank cell) appeared in column B. the results is:
    {0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0}
    so the MATCH of lookup_value "0" gives you the 1st position, which is "Itelligence"

    the COUNTIF in I18 will now count if I17 & I18 appeared in column B. the results is:
    {1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0}
    so it appeared twice & the "0" now is in the 2nd position. hence it returns "Genoa Metal Terminal" now.

    does that help?
    Genius! That works perfectly!! Thank you very much for the explanation. I appreciate it tremendously.

    Raidon

+ 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