+ Reply to Thread
Results 1 to 13 of 13

Find last non blank cell & return column header

  1. #1
    Forum Contributor
    Join Date
    02-07-2016
    Location
    England
    MS-Off Ver
    2019
    Posts
    270

    Find last non blank cell & return column header

    Hi Excel Forum,

    I am using the following formula to look for the last non blank cell in a range and return the text in the column header, it works well but i was wondering if it was possible to adapt it so that it searches for the last P value in range and then return value in the column header. Or even adapt it so it searches for the last value out of the following "P" "M" "D" and then returns the column header.

    Please Login or Register  to view this content.
    Thanks

    Jamidd

  2. #2
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Find last non blank cell & return column header

    Try this

    =(LOOKUP(2,1/(ISNUMBER(FIND("P",UPPER(B4:N4)))+ISNUMBER(FIND("D",UPPER(B4:N4)))+ISNUMBER(FIND("M",UPPER(B4:N4)))),B1:N1))
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  3. #3
    Forum Contributor
    Join Date
    02-07-2016
    Location
    England
    MS-Off Ver
    2019
    Posts
    270

    Re: Find last non blank cell & return column header

    Thanks this works a treat!

    Can i just add to it like so

    (LOOKUP(2,1/(ISNUMBER(FIND("P",UPPER(B4:N4)))+ISNUMBER(FIND("D",UPPER(B4:N4)))+ISNUMBER(FIND("M",UPPER(B4:N4)))+ISNUMBER(FIND("1",UPPER(B4:N4)))+ISNUMBER(FIND("2",UPPER(B4:N4)))),B1:N1))

  4. #4
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Find last non blank cell & return column header

    For "1" and "2" UPPER function not required. It can be used without UPPER function.

  5. #5
    Forum Contributor
    Join Date
    02-07-2016
    Location
    England
    MS-Off Ver
    2019
    Posts
    270

    Re: Find last non blank cell & return column header

    I dont supposed anyone has a way to shorten down this formula a bit?
    I have a few more values to add and it is getting a bit bulky to play with!

    Thanks

    Jamidd

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Find last non blank cell & return column header

    Try like this:

    =LOOKUP(1000,MATCH(B4:N4,{"P","D","M",1,2},0),B1:N1)
    Audere est facere

  7. #7
    Forum Contributor
    Join Date
    02-07-2016
    Location
    England
    MS-Off Ver
    2019
    Posts
    270

    Re: Find last non blank cell & return column header

    This do not seem to be right, it is not returning a value in B1:N1, but i cant work out why!

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,193

    Re: Find last non blank cell & return column header

    Works for me.


    Post a file with incorrect result.

  9. #9
    Forum Contributor
    Join Date
    02-07-2016
    Location
    England
    MS-Off Ver
    2019
    Posts
    270

    Re: Find last non blank cell & return column header

    Very strange! please see attached workbook.

    It works on the example book that kvsrinivasamurthy but when i try this on the workbook ive attached i dont seem to get the same result!

    Thanks

    jamidd
    Attached Files Attached Files
    Last edited by Jamidd1; 12-18-2017 at 07:03 AM.

  10. #10
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,193

    Re: Find last non blank cell & return column header

    This

    =LOOKUP(1000,MATCH(B2:N2,{"P","D","M",1,2},0),$B$1:$N$1)

    B1:N1 must be ABSOLUTE addresses


    To remove #N/A errors ..

    =IFERROR(LOOKUP(1000,MATCH(B2:N2,{"P","D","M",1,2},0),$B$1:$N$1),"")

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

    Re: Find last non blank cell & return column header

    Try:

    =IFERROR(LOOKUP(1000,MATCH(B2:N2,{"P","D","M",1,2},0),$B$1:$N$1),"")

  12. #12
    Forum Contributor
    Join Date
    02-07-2016
    Location
    England
    MS-Off Ver
    2019
    Posts
    270

    Re: Find last non blank cell & return column header

    O OF COURSE!! Sorry this was me being silly, i did not notice i had not made them absolute references

    Thanks John! much appreciated.

  13. #13
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,193

    Re: Find last non blank cell & return column header

    You're welcome.

    And thanks for the rep.

+ 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] To find first non blank cell in a row then return column header
    By divi123 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-11-2022, 04:49 AM
  2. Find last non blank cell and return the header
    By Newbie403 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-29-2015, 12:12 PM
  3. [SOLVED] find header value in column, return cell next to it for copy/paste
    By julzhart in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-15-2014, 10:29 AM
  4. [SOLVED] Find next non blank cell in list and return value from adjacent column
    By kristy.brown in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-19-2014, 03:28 PM
  5. To find first non blank cell in a row then return column header
    By divi123 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-17-2014, 07:14 AM
  6. [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
  7. [SOLVED] Find last non blank cell in a row then return column header
    By Chad B in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-13-2013, 10:33 AM

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