+ Reply to Thread
Results 1 to 6 of 6

Using lookup function on values that are the same only returns one value

  1. #1
    Registered User
    Join Date
    03-04-2018
    Location
    usa
    MS-Off Ver
    2007
    Posts
    3

    Using lookup function on values that are the same only returns one value

    I am using the small function to order times from another sheet.

    From there, I am using the lookup function to retrieve text in a cell next to that time. This works well except when there are duplicate times.

    If I use lookup, I get the first text alphabetically.
    If I use Index match, I get the top text on the other sheet.

    There may be the same text associated with the same time, so that would have to be considered. ie
    NAME1 23sec
    NAME2 23sec
    NAME1 23sec

    Does anyone know any way around this?

    Thanks

  2. #2
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Using lookup function on values that are the same only returns one value

    Hi xcelr. Welcome to the forum.

    Do you mean like output in column C?

    If so this is one way to do it. Try array entering this formula in C1 and fill down. If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    A
    B
    C
    1
    NAME1
    0:00:23
    NAME1
    2
    NAME2
    0:00:23
    NAME1
    3
    NAME1
    0:00:23
    NAME2
    Dave

  3. #3
    Registered User
    Join Date
    03-04-2018
    Location
    usa
    MS-Off Ver
    2007
    Posts
    3

    Re: Using lookup function on values that are the same only returns one value

    Thanks, Ill try it out.

    I dont know how to add the table in here so I am having trouble explaining.

    In your example, column B is in ascending order from a small function from data in another sheet. This works fine. Column A is what I am having problems with acquiring both names that have that 23sec time. Im always getting one name and not the next name with that same time. Column C doesn't matter.

    Pretend the below are tables:

    SHEET WITH DATA NOT IN ASC. ORDER
    name3 name5 name 5 20sec
    nameA nameB name C 16sec
    name4 name4 name 4 19sec
    name1 name2 name 3 21sec
    namex namex name x 17sec
    namea nameb namec 17sec

    SHEET W/ FUNCTIONS
    nameA nameB name C 16sec <---WORKS
    namex namex name x 17sec <---WORKS
    namex namex name x 17sec <---BROKEN - should be namea,b,c
    name4 name4 name 4 19sec <---WORKS
    name3 name5 name 5 20sec <---WORKS
    name1 name2 name 3 21sec <---WORKS

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Using lookup function on values that are the same only returns one value

    Will you please attach a sample Excel workbook?

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,192

    Re: Using lookup function on values that are the same only returns one value

    With "input" in columns A1:D6

    in E1

    =INDEX(A$1:A$6,MATCH(SMALL(COUNTIF($D$1:$D$6,"<="&$D$1:$D$6)+ROW($A$1:$A$6)/10^5+$D$1:$D$6,ROWS($A$1:$A1)),COUNTIF($D$1:$D$6,"<="&$D$1:$D$6)+ROW($A$1:$A$6)/10^5+$D$1:$D$6,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.

    THEN copy across and down

  6. #6
    Registered User
    Join Date
    03-04-2018
    Location
    usa
    MS-Off Ver
    2007
    Posts
    3

    Re: Using lookup function on values that are the same only returns one value

    I uploaded a file but I dont see it here.

    Thanks John, Ill give it a try.
    Attached Files Attached Files

+ 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] match function lookup array returns wrong value
    By elenama in forum Excel General
    Replies: 5
    Last Post: 08-17-2015, 06:13 AM
  2. Replies: 5
    Last Post: 03-26-2014, 08:30 AM
  3. Lookup function returns Type mismatch??
    By Xceller in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-23-2014, 06:38 PM
  4. MACO that does a lookup on values entered in one workbook, returns results from another WB
    By drobinson782001 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-27-2013, 03:35 PM
  5. Nested LOOKUP function returns incorrect data
    By TheAkwardOne in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-29-2008, 12:15 AM
  6. Lookup returns hyperlinked values as normal text
    By KarenF in forum Excel General
    Replies: 13
    Last Post: 08-10-2006, 03:30 AM
  7. [SOLVED] Lookup returns hyperlinked values as normal text
    By KarenF in forum Excel General
    Replies: 0
    Last Post: 08-08-2006, 10:35 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