+ Reply to Thread
Results 1 to 7 of 7

Extract unique values from a table and list along a row

  1. #1
    Registered User
    Join Date
    09-28-2012
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Extract unique values from a table and list along a row

    Hi,

    I need some help with creating an excel formula that can do the following:

    1. Extract unique values from a table column, on the condition that the value of another column in the table includes certain text. This text will be selected from a drop down menu which already exists. The table will vary in the number of rows it has as its constantly being updated.

    2. Take these unique values and list them along a row of a new table.

    For example in the attached spreadsheet, i want to return unique 'Products' from the source table in cells G9, H9, I9 and so on, only for the 'Advertiser' that appears in cell G6. I then want to use these unique products and the date, to return the associated costs in the newly created table.

    This all needs to happen automatically as the source data will be constantly changing, and the output table will be used to automatically update charts which are part of a 'dashboard' summary. For that reason i dont think i can do this using conditional formatting.

    I'd be really grateful for any help in solving this.

    Thanks,
    Colin
    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: Extract unique values from a table and list along a row

    hi Colin. are you still using Excel 2003? do change your MS Off Ver in your profile if you have upgraded. we can provide you better formulas available. i'm guessing you have a new version because you uploaded an xlsx file. it's also good to type out manually what you hope to see in the file. i'm guessing you want the unique products in row 9 based on the Advertiser. so try this array formula in F9:
    =IFERROR(INDEX($C$2:$C$16,MATCH(0,IF($B$2:$B$16=$G$6,COUNTIF($E9:E9,$C$2:$C$16)),0)),"")

    in F10:F12, i'm guessing you want the unique dates, so:
    =IFERROR(INDEX($A$2:$A$16,MATCH(0,IF($B$2:$B$16=$G$6,COUNTIF(F$9:F9,$A$2:$A$16)),0)),"")

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    not sure how you want the values there, but Pivot Table actually solves the issue. check the file. do note that cereal1 & cereal 1 appeared twice because of the space
    Attached Files Attached Files

    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
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extract unique values from a table and list along a row

    You can also use non-array, regular formulas to get unique values

    If you using Excel 2007 or higher use these formulas

    for Advertisers:

    =IFERROR(INDEX($B$2:$B$16,MATCH(0,INDEX(COUNTIF($F$1:F1,$B$2:$B$16),0,0),0)),"")

    for Dates

    =IFERROR(INDEX($A$2:$A$16,MATCH(0,INDEX(COUNTIF($F$9:F9,$A$2:$A$16),0,0),0)),"")

    If you still using Excel 2003 use formulas below

    =IF(ISERROR(INDEX($B$2:$B$16,MATCH(0,INDEX(COUNTIF($F$1:F1,$B$2:$B$16),0,0),0))),"",INDEX($B$2:$B$16,MATCH(0,INDEX(COUNTIF($F$1:F1,$B$2:$B$16),0,0),0)))


    =IF(ISERROR(INDEX($A$2:$A$16,MATCH(0,INDEX(COUNTIF($F$9:F9,$A$2:$A$16),0,0),0))),"",INDEX($A$2:$A$16,MATCH(0,INDEX(COUNTIF($F$9:F9,$A$2:$A$16),0,0),0)))
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  4. #4
    Valued Forum Contributor
    Join Date
    10-14-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2019
    Posts
    353

    Re: Extract unique values from a table and list along a row

    What about a pivot table ?
    Attached Files Attached Files
    Kind regards,
    Piet Bom

  5. #5
    Registered User
    Join Date
    09-28-2012
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Extract unique values from a table and list along a row

    Thanks everyone for the responses

    I am using Excel 2007, so i will be sure to change the profile to reflect that. Is there any benefits from not using the array method? I see that there is an option to do this without using arrays in excel 2007 onwards. I am finding that when using the array it is slowing my excel sheet down very markedly. The source data is about 40,000 rows of data and it is quite common for more than 20 unique values to be pulled out using the approaches you have mentioned here.

    Re. the pivot table, im not sure this would work as the pivot table (and associated pivot chart) would have to update with all the values based on a data validation drop-down in another worksheet showing a particular text string. The idea is that i drop source data into a holding worksheet each morning, and the only work that is needed to be done is selecting something from a single drop down menu. This should then create a chart based on the values which are populated in the rows (the original problem i described).

    In any case, thanks very much for your help so far!

    Colin

  6. #6
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extract unique values from a table and list along a row

    You're welcome. Don't forget to thank those who helped by clicking on Add Reputation * and please mark thread as "Solved" if your issue has been resolved. (Selecting Thread Tools-> Mark thread as Solved).

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Extract unique values from a table and list along a row

    Is there any benefits from not using the array method?
    The only difference in the array and non-array formulas is that the non-array formulas use an additional INDEX function.

    So, the non-array formulas are no more efficient than the array entered formulas.

    Some tasks (using formulas) take some amount of time to complete when you apply them to a lot of data. Extracting uniques from 40k rows of data is one of those tasks.
    Last edited by Tony Valko; 11-05-2013 at 04:40 PM.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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. extract number values from a table and make a list
    By mischge in forum Excel General
    Replies: 27
    Last Post: 08-14-2013, 04:00 AM
  2. [SOLVED] Extract Unique Values from Long list and Put in Sorted Order
    By snapfade in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 04-08-2013, 09:10 PM
  3. [SOLVED] Extract unique values out of list based on an extra criteria
    By sven1975 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-11-2012, 05:02 AM
  4. Extract Unique Values, Then Extract Again to Remove Suffixes
    By Karl Burrows in forum Excel General
    Replies: 23
    Last Post: 06-25-2005, 08:05 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