+ Reply to Thread
Results 1 to 14 of 14

Lookup value returns duplicates

  1. #1
    Forum Contributor
    Join Date
    06-08-2021
    Location
    Toronto
    MS-Off Ver
    2016
    Posts
    101

    Lookup value returns duplicates

    Hi,

    Here is the sample data.

    Column A: Toyota, Kia, Honda, Mercedes
    Column B: 4, 5, 6, 4

    Column C: Toyota, Toyota, Kia, Honda
    Column D: 4, 4, 5, 6

    Formula used in Column C: =IFERROR(INDEX(D2,MATCH(D2,$B$2:$B$5,0),1),"")
    Formula used in Column D: =IFERROR(SMALL($B$2:$B$5,ROWS($B$2:B2)),"")

    As you can see the issue is in Column C where C3 is returning "Toyota" where I want it to return "Mercedes". Due to the complexity of my data and it arrangement, I cannot have a helper column to solve this issue. Could you guys help me with one formula to use in Column C that can fix the issue.

    Thanks

    PS: This is my first time posting in the forum. Hence, I am not sure if my sample file has been successfully uploaded. Apologies if the file is not available.
    Last edited by Vj Raj; 06-10-2021 at 03:04 PM.

  2. #2
    Forum Contributor
    Join Date
    06-08-2021
    Location
    Toronto
    MS-Off Ver
    2016
    Posts
    101

    Re: Lookup value returns duplicates

    I have attached a sample data file here.
    Attached Files Attached Files

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Lookup value returns duplicates

    You haven't said what you are trying to do and and your formulae are inconsistent with your description. e.g. C does not return Toyota but the number 4

    Please upload a workbook or a representative cut down copy, anonymised if necessary. It is always easier to advise if we can see your request in its context.

    Show a before and after situation with manually calculated results, explaining which information is data and which is results, and if it's not blindingly obvious how you have arrived at your results some explanatory notes as well.

    To upload a file click the Go Advanced button at the foot of your post, look underneath the post area for the Manage Attachments section and take it from there.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Forum Contributor
    Join Date
    06-08-2021
    Location
    Toronto
    MS-Off Ver
    2016
    Posts
    101

    Re: Lookup value returns duplicates

    Hi Richard,

    Thanks for your response. I have attached a sample data file above (as a reply). I have highlighted where the issue is in the sheet. Column A and Column B is part of the source data (Table 1). Column C and Column D are recreated from Table 1 to be then used in a chart. Column D sorts Column B's values in ascending order. Columnd C then should return values from Column A matching Column D and Column B. I am looking to return unique values based on a value in another column. In the above example, Column C should First return "Toyota" matching the first value "4" in column D and then return "Mercedes" matching the second value which is also "4". The lookup array in this scenario is A2:B5.

    Hope this explains the issue better.

  5. #5
    Valued Forum Contributor
    Join Date
    05-15-2017
    Location
    US
    MS-Off Ver
    365
    Posts
    901

    Re: Lookup value returns duplicates

    Looking at your file, what are you trying to accomplish with this ROWS($K$2:K2) in your SMALL function? i ask because as you move down the column N, that range changes.. so not sure what you are trying to do with that.
    If all you are wanting is the "Car" name based on the "number" for the month selected, maybe consider sticking with just index/match(preferred) or vlookup
    If you find the suggestion or solution helpful, please consider adding reputation to the post.

  6. #6
    Forum Contributor
    Join Date
    06-08-2021
    Location
    Toronto
    MS-Off Ver
    2016
    Posts
    101

    Re: Lookup value returns duplicates

    Hi Cubangt,

    Thanks for your comments. Column N is to sort the values from Column K in ascending order. ROWS($K$2:K2) helps the SMALL function as it increments going down the column returning the first smallest value, then the second smallest and so forth. The issue is in Column M where the car names are repeating but it should be unique (if you look at the car names in column A. This is what I am trying to achieve.
    Last edited by Vj Raj; 06-10-2021 at 03:17 PM.

  7. #7
    Valued Forum Contributor
    Join Date
    05-15-2017
    Location
    US
    MS-Off Ver
    365
    Posts
    901

    Re: Lookup value returns duplicates

    Since you are doing a "exact match" in the match function, its going to take the first one and return that one always..
    Just curious why you cant turn it around and use the car name as your lookup value and return the number, that way you always get your unique car value?

  8. #8
    Forum Contributor
    Join Date
    06-08-2021
    Location
    Toronto
    MS-Off Ver
    2016
    Posts
    101

    Re: Lookup value returns duplicates

    I couldn't do it as for the chart, I need it to be in descending order (as you see in the file). For each month, the values change for the cars, hence the Column M is dynamic based on Column N.

  9. #9
    Valued Forum Contributor
    Join Date
    05-15-2017
    Location
    US
    MS-Off Ver
    365
    Posts
    901

    Re: Lookup value returns duplicates

    I changed to using your J and K column since that range is returning the correct data, got the zero's to be hidden, but still working on hiding the labels for any that are zero

    in the mean time, you can take a look at this post and see if this helps.. If i can get the labels squared away, ill upload the file for you to test.

    https://www.excelforum.com/excel-cha...-or-blank.html

    Screenshot 2021-06-10 150505.jpg

    I think that link would help, seems in order to hide the values that are zero, you need to have your chart use the value for the axis value and then for displaying purpose your configure it to display the name, so that the formula can hide the zero values (which in turn hides the name value as well) at least thats the way i read that post #2 on the link
    Last edited by cubangt; 06-10-2021 at 04:11 PM.

  10. #10
    Forum Contributor
    Join Date
    06-08-2021
    Location
    Toronto
    MS-Off Ver
    2016
    Posts
    101

    Re: Lookup value returns duplicates

    Appreciate the effort Cubangt. I will check the link out.

    Thanks !

  11. #11
    Valued Forum Contributor
    Join Date
    05-15-2017
    Location
    US
    MS-Off Ver
    365
    Posts
    901

    Re: Lookup value returns duplicates

    ill keep trying as i have time, post back if the link doesnt help.. there is a solution, just need to find the right order of things

  12. #12
    Forum Contributor
    Join Date
    06-08-2021
    Location
    Toronto
    MS-Off Ver
    2016
    Posts
    101

    Re: Lookup value returns duplicates

    Hi Cubangt,

    Thanks again. Would you mind uploading the file with the changes that you made to the table. The data looks good to me. As with the graph, I can fix that. I use named ranges (Data and Value) for the columns with the following formula (with a count value) and then use the names ranges to plot the graph which works in terms of removing zeros.

    =Sales!$N$2:INDEX(Sales!$N$2:$N$11,Sales!$N$13)

    You can also find it in the Name Manager tab in the file that I sent you.

  13. #13
    Valued Forum Contributor
    Join Date
    05-15-2017
    Location
    US
    MS-Off Ver
    365
    Posts
    901

    Re: Lookup value returns duplicates

    Here is the file.
    Attached Files Attached Files

  14. #14
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,401

    Re: Lookup value returns duplicates

    Cell M2 array formula , Drag down and accross

    HTML Code: 

+ 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. Lookup table help - multiple returns for one lookup value
    By radddogg in forum Excel Formulas & Functions
    Replies: 24
    Last Post: 09-16-2016, 02:22 PM
  2. Lookup returns N/A
    By amartino44 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-21-2013, 05:06 PM
  3. what formula is like match but returns Duplicates
    By Nazerith in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-07-2011, 02:12 PM
  4. Replies: 2
    Last Post: 09-21-2011, 02:37 PM
  5. adv. filter unique records only returns duplicates
    By stratplayer in forum Excel General
    Replies: 4
    Last Post: 01-31-2011, 05:52 PM
  6. Excel 2008 : Lookup same value, different returns
    By washkow in forum Excel General
    Replies: 1
    Last Post: 05-26-2010, 11:48 AM
  7. LOOKUP returns #N/A
    By roadapple in forum Excel General
    Replies: 4
    Last Post: 02-04-2009, 10:15 AM

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