+ Reply to Thread
Results 1 to 7 of 7

How to Return Header Value in all rows

  1. #1
    Forum Contributor
    Join Date
    09-19-2017
    Location
    Taguig City, Philippines
    MS-Off Ver
    Microsoft Excel 2016
    Posts
    120

    How to Return Header Value in all rows

    Hi,

    Hoping to find a little help, I was hoping to have a formula in column A that will automatically return the header value in column C for all line items under each cost code.

    Please see attached. I'm trying to think that a formula be like, if the cell is blank, return previous value. Or return header value under 'Ref'.

    Thank you very much.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: How to Return Header Value in all rows

    I expect your real data will be different, and refs will be actual numbers
    =IF(OR(B5="ref",C5<>""),"",IF(C3<>"",C3,A5)) may work in a5

    or
    =IF(OR(C4<>"",C5<>""),"",IF(C3<>"",C3,A5))

  3. #3
    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,914

    Re: How to Return Header Value in all rows

    In A4 drag copied down:

    =IF(OR(B4="Ref",C4<>"",B4=""),"",LOOKUP(2,1/(B$4:B4="Ref"),C$3:C3))
    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.

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: How to Return Header Value in all rows

    IN A5:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and copy down.

    Edit: Ali beat me to it!
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  5. #5
    Forum Contributor
    Join Date
    09-19-2017
    Location
    Taguig City, Philippines
    MS-Off Ver
    Microsoft Excel 2016
    Posts
    120

    Re: How to Return Header Value in all rows

    Hi Everyone,

    Thank you for your formulas, it worked perfectly on my sheet, I just encountered some issues with my actual sheet as I realized there are some blank lines in between in column B so the tendency, the formula returns a blank cell too. Because of that I just thought maybe it would be more effective if we only use the "Ref" as reference and then the formula is supposed to return the value above it, see attached. So that in this case the formula only needs to find one criteria.

    Hope you can help me still. Thank you very much!


    EDIT :

    Hello again,

    I tried to twitch Ali's formula and I almost got it, however if you can again look at the edited version of my sheet, cell A11 and A14 should be blank however I could not find the right formula to make it blank too. Thank you all for the help!!!
    Attached Files Attached Files
    Last edited by MyStix01; 11-25-2019 at 03:24 AM.

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: How to Return Header Value in all rows

    Changing the returned range in my formula:

    In A5:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and copy down.

  7. #7
    Forum Contributor
    Join Date
    09-19-2017
    Location
    Taguig City, Philippines
    MS-Off Ver
    Microsoft Excel 2016
    Posts
    120

    Re: How to Return Header Value in all rows

    Hi Olly,

    This is perfect, thank you so much for the help. By the way, I figured that this formula works too.

    =IFERROR(IF(OR(B5="Ref",B6="Ref",B5="Job Totals:"),"",LOOKUP(2,1/(B$4:B5="Ref"),B$3:B4)),"")

    Thank you all for the help!

+ 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] Search nearest value above in table. return header row + header column
    By 323428 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-22-2018, 05:06 AM
  2. Find Max value and return column header, multiple rows
    By Setanta11 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-13-2015, 04:58 AM
  3. [SOLVED] Find specific value in table and return header row and header column value
    By nelwan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-30-2013, 01:35 AM
  4. Need to copy header row in group to all rows below header; stop if blank and repeate
    By jmcaleer10 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-18-2013, 11:09 AM
  5. Replies: 4
    Last Post: 03-13-2013, 12:38 PM
  6. Vlookup return the header name of table (Table of 4 column x 55 rows)
    By sanpat in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-09-2013, 11:23 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