+ Reply to Thread
Results 1 to 11 of 11

Lookup row value(s) and return column header

  1. #1
    Registered User
    Join Date
    06-27-2016
    Location
    Los Angeles, CA
    MS-Off Ver
    2013
    Posts
    7

    Lookup row value(s) and return column header

    Hello all. Searched all day and tried many different formulas but to no avail.

    Have it down to an INDEX and SUMPRODUCT function but can't quite figure it out.

    Description:

    Column headers are all dates, row headers are all customer names. Matrix data consists of 1,2,3,4 or 5.

    I need a formula to lookup whether a 1, 2, 3, 4, or 5 appears, and result in the column header. There can be multiple values in one row so that is a complicating factor.


    A1 A2 A3 A4 A5 A6 A7
    Description Jul 2016 Aug 2016 Sep 2016 Oct 2016 Nov 2016 RESULT
    Customer 1 1 0 0 0 2 Jul 2016, Nov 2016
    Customer 2 0 3 0 2 0 Aug 2016, Oct 2016
    Customer 3 0 0 1 0 0 Sep 2016
    Customer 4 0 0 3 1 0 Sep 2016, Nov 2016
    Customer 5 1 0 0 0 0 Jul 2016
    Customer 6 0 1 0 0 0 Aug 2016

    Can someone point me in the right direction? Thank you!

  2. #2
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,370

    Re: Lookup row value(s) and return column header

    as shown your table in A1 to F7 ( include header)

    put your criteria on B9, ie 1 or 2 or 0

    put this formula on C9

    =IFERROR(INDEX($B$1:$F$1,MOD(SMALL(IF($B$2:$F$7=$B$9,(ROW($B$2:$F$7)-ROW($B$2)+1)*10^5+COLUMN($B$2:$F$7)-COLUMN($B$2)+1),ROWS($A$1:A1)),10^5)),"")

    and press F2 button to open the formula, then press all together CTRL+SHIFT+ENTER button (array formula style), last step is copied down until blank results

    hope it works

  3. #3
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Lookup row value(s) and return column header

    see attached solution CSE Solution...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.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  4. #4
    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: Lookup row value(s) and return column header

    Withdrawn by FR.
    Dave

  5. #5
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Lookup row value(s) and return column header

    slight change in case there is none that fall into criteria

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Lookup row value(s) and return column header

    in the case where it needs to be between 1-5
    change this section
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    so it becomes
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  7. #7
    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: Lookup row value(s) and return column header

    This uses helper columns then concatenates the results.

    Array enter this in G2 as in the below. Fill down and across to K7.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Then this regular formula in L2 and fill down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.




    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    1
    Description
    Jul/1/2016
    Aug/1/2016
    Sep/1/2016
    Oct/1/2016
    Nov/1/2016
    Helper 1
    Helper 2
    Helper 3
    Helper 4
    Helper 5
    RESULT
    2
    Customer 1
    1
    0
    0
    0
    2
    Jul/1/2016,
    Nov/1/2016,
    Jul/1/2016, Nov/1/2016
    3
    Customer 2
    0
    3
    0
    2
    0
    Aug/1/2016,
    Oct/1/2016,
    Aug/1/2016, Oct/1/2016
    4
    Customer 3
    0
    0
    1
    0
    0
    Sep/1/2016,
    Sep/1/2016
    5
    Customer 4
    0
    0
    3
    1
    0
    Sep/1/2016,
    Oct/1/2016,
    Sep/1/2016, Oct/1/2016
    6
    Customer 5
    1
    0
    0
    0
    0
    Jul/1/2016,
    Jul/1/2016
    7
    Customer 6
    0
    1
    0
    0
    0
    Aug/1/2016,
    Aug/1/2016

  8. #8
    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: Lookup row value(s) and return column header

    This is a shorter helper formula than my last. Still array entered.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    06-27-2016
    Location
    Los Angeles, CA
    MS-Off Ver
    2013
    Posts
    7

    Re: Lookup row value(s) and return column header

    Quote Originally Posted by humdingaling View Post
    see attached solution CSE Solution...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.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Wow, you're brilliant. Thank you. This worked phenomenally.

  10. #10
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,914

    Re: Lookup row value(s) and return column header

    Or try this ...

    =SUBSTITUTE(TRIM(IF(B2>0,TEXT($B$1,"MMM-YY "),"")&IF(C2>0,TEXT($C$1,"MMM-YY "),"")&IF(D2>0,TEXT($D$1,"MMM-YY "),"")&IF(E2>0,TEXT($E$1,"MMM-YY "),"")&IF(F2>0,TEXT($F$1,"MMM-YY "),""))," ",", ")

  11. #11
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Lookup row value(s) and return column header

    oh dear..
    i may have over complicated lol
    yes phuocam version is much easier

+ 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. How to lookup value in table and return column header
    By Zimmerman in forum Excel General
    Replies: 3
    Last Post: 03-14-2016, 08:53 AM
  2. Replies: 4
    Last Post: 03-13-2013, 12:38 PM
  3. Lookup value, return column header
    By jvp123 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-28-2012, 10:50 AM
  4. Replies: 5
    Last Post: 12-24-2011, 12:16 PM
  5. Lookup Row, Return Column Header
    By matt4003 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-22-2010, 07:43 AM
  6. [SOLVED] Lookup Value in Range/Array and Return Column Header Value
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-13-2010, 08:17 AM
  7. Replies: 3
    Last Post: 06-16-2006, 02:10 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