+ Reply to Thread
Results 1 to 9 of 9

Lookup to return Column Header when column data is not 0

  1. #1
    Registered User
    Join Date
    08-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2007/2010/365
    Posts
    82

    Lookup to return Column Header when column data is not 0

    I need to lookup and returm multiple results when the column data is not zero.

    Attached is a sample worksheet with the desired results. I need a fomular in Ordering Trend on Column B and Column C. Can this be done using fomular or need a VBA?
    Attached Files Attached Files

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

    Re: Lookup to return Column Header when column data is not 0

    Try this in B2:

    =IFERROR(INDEX(OrderMonth,AGGREGATE(15,6,COLUMN(OrderMonth)
    /(INDEX(Data!$B$2:$M$6,MATCH($A$2,Customer,0),0)<>0),ROWS($A$2:A2))-1),"")

    in C2:

    =IF(B2="","",INDEX(Data!$B$2:$M$6,MATCH($A$2,Customer,0),MATCH(B2,OrderMonth,0))

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

    Re: Lookup to return Column Header when column data is not 0

    Put this on B2 and ENTERD as ARRAY FORMULAS, then copied down until blanks:
    =IFERROR(INDEX(Data!$B$1:$M$1,SMALL(IF(INDEX(Data!$B$2:$M$6,MATCH(A$2,Data!$A$2:$A$6,0),0)<>0,COLUMN(Data!$B$1:$M$1)-COLUMN(Data!$B$1)+1),ROWS($A$1:A1))),"")

    And this on C2 then copied down:
    =IFERROR(INDEX(Data!$B$2:$M$6,MATCH($A$2,Data!$A$2:$A$6,0),MATCH($B2,Data!$B$1:$M$1,0)),"")
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    08-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2007/2010/365
    Posts
    82

    Re: Lookup to return Column Header when column data is not 0

    Thank you Phuocam and azumi, Phuocam's fomular works and azumi's file cannot open and the fomular works on row 1 only. I shall close this.

  5. #5
    Registered User
    Join Date
    08-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2007/2010/365
    Posts
    82

    Re: Lookup to return Column Header when column data is not 0

    Dear Phuocam, may I know what does these 2 numbers 15, 6 means in "AGGREGATE(15,6,COLUMN(OrderMonth)" ? My original data column starts from K to AV, and the data row starts from row 8 to 400.

  6. #6
    Registered User
    Join Date
    08-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2007/2010/365
    Posts
    82

    Re: Lookup to return Column Header when column data is not 0

    Quote Originally Posted by Phuocam View Post
    Try this in B2:

    =IFERROR(INDEX(OrderMonth,AGGREGATE(15,6,COLUMN(OrderMonth)
    /(INDEX(Data!$B$2:$M$6,MATCH($A$2,Customer,0),0)<>0),ROWS($A$2:A2))-1),"")

    in C2:

    =IF(B2="","",INDEX(Data!$B$2:$M$6,MATCH($A$2,Customer,0),MATCH(B2,OrderMonth,0))
    Dear Phuocam, may I know what does these 2 numbers 15, 6 means in "AGGREGATE(15,6,COLUMN(OrderMonth)" ? My original data column starts from K to AV, and the data row starts from row 8 to 400.

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

    Re: Lookup to return Column Header when column data is not 0


  8. #8
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,444

    Re: Lookup to return Column Header when column data is not 0

    Read this about the AGGREGATE function https://support.office.com/en-us/art...6-e19993fa26df

  9. #9
    Registered User
    Join Date
    08-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2007/2010/365
    Posts
    82

    Re: Lookup to return Column Header when column data is not 0

    Thank you, Phuocam.

+ 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. Two dimensional lookup return column header
    By stephboucher in forum Excel General
    Replies: 3
    Last Post: 09-24-2016, 02:24 PM
  2. Lookup row value(s) and return column header
    By robertdouglasC in forum Excel General
    Replies: 10
    Last Post: 06-28-2016, 01:25 AM
  3. 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
  4. Replies: 4
    Last Post: 03-13-2013, 12:38 PM
  5. lookup formula to return data where column header matches
    By tim-harrison in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-06-2013, 12:58 AM
  6. Lookup value, return column header
    By jvp123 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-28-2012, 10:50 AM
  7. Lookup Row, Return Column Header
    By matt4003 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-22-2010, 07:43 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