+ Reply to Thread
Results 1 to 13 of 13

How to return the top row value of the column that is after the last blank cell in a row?

  1. #1
    Registered User
    Join Date
    05-03-2022
    Location
    Montreal, Canada
    MS-Off Ver
    365
    Posts
    6

    How to return the top row value of the column that is after the last blank cell in a row?

    Hello,

    Looking for support coding a formula that will return the value in the top row for the column that has value after the last blank of a row. To explain what I mean, here's a screen shot with the expected results:

    Screenshot 2022-05-03 101705.png

    Thanks!

    SC

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,084

    Re: How to return the top row value of the column that is after the last blank cell in a r

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

  3. #3
    Registered User
    Join Date
    05-03-2022
    Location
    Montreal, Canada
    MS-Off Ver
    365
    Posts
    6

    Re: How to return the top row value of the column that is after the last blank cell in a r

    Yeah tried that, the last 3 rows return "Jerry" because it's the last column with data. It works for Suzanne and "#N/A" though.

  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,987

    Re: How to return the top row value of the column that is after the last blank cell in a r

    Try this:

    =LOOKUP(2,1/(A3:H3<>""),$B$1:$I$1)
    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
    Registered User
    Join Date
    05-03-2022
    Location
    Montreal, Canada
    MS-Off Ver
    365
    Posts
    6

    Re: How to return the top row value of the column that is after the last blank cell in a r

    Tried that one as well, first row returns Jerry, second #N/A and last 3 are blanks. Also tried LOOKUP(2,1/(A3:H3=""),$B$1:$I$1) and it works for Monic and Pierre but rest is incorrect.

  6. #6
    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,987

    Re: How to return the top row value of the column that is after the last blank cell in a r

    There are instructions at the top of the page explaining how to attach your sample workbook.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, relevant cells highlighted and a few explanatory notes.

  7. #7
    Registered User
    Join Date
    05-03-2022
    Location
    Montreal, Canada
    MS-Off Ver
    365
    Posts
    6

    Re: How to return the top row value of the column that is after the last blank cell in a r

    Here's the sample Excel doc (with expected result) to try formulas.
    Attached Files Attached Files

  8. #8
    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,987

    Re: How to return the top row value of the column that is after the last blank cell in a r

    Sorry - I am not fully understanding your logic. I think you are going to need to tell us why you want the answers you say you want where the expected results do not actually match your description in post #1.

  9. #9
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: How to return the top row value of the column that is after the last blank cell in a r

    Please try

    =LET(z,A3:H3,y,$A$1:$H$1,IFERROR(INDEX(y,1+COLUMNS(z)-FIND(10,CONCAT(SORTBY(IF(z>0,1,0),COLUMN(z),-1))&0)),""))

    or
    =IFNA(LOOKUP(2,1/(A3:G3<>B3:H3)/(A3:G3=""),$B$1:$H$1),IF(COUNTA(B3:H3),$A$1,""))
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    05-03-2022
    Location
    Montreal, Canada
    MS-Off Ver
    365
    Posts
    6

    Re: How to return the top row value of the column that is after the last blank cell in a r

    I'm sorry, not sure I understand your response AliGW. The contents of the file I uploaded "Sample.xlsx" mirrors the image I attached in the original post, they are absolutely identical I triple-checked.

    Now, here's another way of describing what I would like the formula to do: For every row I want to identify the column after the last blank in the row and return that column's top row value. In the image and in the sample file, I manually inputted the response I expect from the formula in the last column.

    Thank you so much for looking into this and for all your help.

  11. #11
    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,987

    Re: How to return the top row value of the column that is after the last blank cell in a r

    I'm sorry, not sure I understand your response AliGW.
    I don't fully follow your logic - I asked for the workbook just so that I didn't have to faff about recreating data that you already had, and I said nothing about anything having changed.

    When you are close to your data, you know exactly what you want: sometimes that isn't completely obvious to others, so sometimes you have to be prepared to elaborate a bit.

    Anyway, you have a solution in post #9.

    For every row I want to identify the column after the last blank in the row and return that column's top row value
    Two of the rows clearly need further explanation, as they do not fit this overarching requirement.

  12. #12
    Registered User
    Join Date
    05-03-2022
    Location
    Montreal, Canada
    MS-Off Ver
    365
    Posts
    6

    Re: How to return the top row value of the column that is after the last blank cell in a r

    Quote Originally Posted by bo_ry View Post
    please try

    =let(z,a3:h3,y,$a$1:$h$1,iferror(index(y,1+columns(z)-find(10,concat(sortby(if(z>0,1,0),column(z),-1))&0)),""))

    or
    =ifna(lookup(2,1/(a3:g3<>b3:h3)/(a3:g3=""),$b$1:$h$1),if(counta(b3:h3),$a$1,""))
    that's it!!!! Thank you

  13. #13
    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,987

    Re: How to return the top row value of the column that is after the last blank cell in a r

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, you may not be aware that you can thank those who have helped you by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of all those who offered 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. Replies: 5
    Last Post: 12-22-2021, 07:32 AM
  2. Replies: 5
    Last Post: 06-24-2020, 04:50 AM
  3. Return Row header in given column if cell non-blank
    By maggieapple in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-26-2020, 03:18 PM
  4. HELP find value in cell return header column non-blank
    By korn_02 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-06-2019, 02:12 AM
  5. [SOLVED] Return Column Header for First Blank Cell in Row
    By jkapala in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-28-2018, 02:26 PM
  6. [SOLVED] Return blank cell for formula is there's a match in a column?
    By djarcadian in forum Excel General
    Replies: 3
    Last Post: 02-18-2015, 10:54 AM
  7. Search first non-blank cell to return a value in another column
    By staccato20# in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-09-2014, 03:07 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