+ Reply to Thread
Results 1 to 7 of 7

Formula to return Header if cell content is 1

  1. #1
    Forum Contributor
    Join Date
    06-25-2013
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    114

    Formula to return Header if cell content is 1

    Hi All,

    I have come across a situation where I need to retrieve the header from an dataset. Basically I would need the headers to return where ever 1 is present.

    I have attached sample spreadsheet for reference.

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Formula to return Header if cell content is 1

    Would a presentation as follows work for you?

    v A B C D E F G H I J K
    1 Attribute A B C D E F G H I J
    2 Event1
    3 Event12 1 1 1
    4 Event2 1 1 1 1
    5 Event23 1 1 1 1
    6 Event3 1 1
    7 Event34 1 1
    8 favor1 1 1
    9 favor2 1 1 1 1 1 1
    10 free1 1 1
    11 free2 1 1
    12 promotion1 1 1 1
    13 promotion2 1 1 1
    14 promotion3 1 1 1 1 1
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    06-25-2013
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    114

    Re: Formula to return Header if cell content is 1

    Hi Alan,

    this ways also works good for me..

  4. #4
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,782

    Re: Formula to return Header if cell content is 1

    B18=IFERROR(INDEX($B$2:$N$2,SMALL(IF($A$3:$A$12=B$17,IF($B$3:$N$12=1,COLUMN($B$2:$N$2)-COLUMN($B$2)+1)),ROWS($B$18:B18))),"")

    control+shift+enter

    copy across and down

  5. #5
    Forum Contributor
    Join Date
    06-25-2013
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    114

    Re: Formula to return Header if cell content is 1

    Hi Alen, thanks for the function.. however I am getting False as my output even after applying Array (control+shift+enter)
    )

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Formula to return Header if cell content is 1

    Since my post #2 is satisfactory for you, here is how using Power Query. Here is the Mcode and the file attached for your review and analysis

    Please Login or Register  to view this content.
    Load the table into Power Query. Highlight column A and unpivot all other columns. Pivot the columns using Column 1 as your headers and do not aggregate. Next highlight all columns and use the replace function to replace all zeros with nulls. Close and Load to your excel wb.
    Attached Files Attached Files
    Last edited by alansidman; 03-19-2020 at 12:13 PM.

  7. #7
    Forum Contributor
    Join Date
    06-25-2013
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    114

    Re: Formula to return Header if cell content is 1

    Thanks Alan. I will try

+ 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. Insert (with formatting!) content of a cell into a header
    By tks1183 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-09-2012, 08:48 PM
  2. Cell Content to Page Header
    By Mag8765 in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 02-12-2012, 08:26 PM
  3. Cell Content as Header?
    By alex3867 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-09-2006, 09:59 AM
  4. [SOLVED] cell content in header/footer?
    By Stefi in forum Excel General
    Replies: 1
    Last Post: 06-02-2006, 03:20 AM
  5. Use a cell's content as part of Header
    By swatsp0p in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-17-2006, 10:31 AM
  6. view cell content in header
    By John in Surrey in forum Excel General
    Replies: 1
    Last Post: 12-30-2005, 11:10 AM
  7. Cell content in custom header: How?
    By Brian __ Lowe in forum Excel General
    Replies: 3
    Last Post: 11-30-2005, 08:25 AM
  8. [SOLVED] insert the content of a cell into a header/footer
    By subscriptionsink in forum Excel General
    Replies: 1
    Last Post: 05-26-2005, 05:15 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