+ Reply to Thread
Results 1 to 11 of 11

Returning the last non-blank value in a horizontal range

  1. #1
    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,869

    Returning the last non-blank value in a horizontal range

    I know that this has been asked before, as I have found some possible solutions that involve array formulae, but I'm wondering if anyone knows how to do it without one.

    I want to be able to return the value of the last non-blank cell in the horizontal range L3:BF3. This would need to account for any blank cells that might occur within the range. Those 'blank' cells would contain formulae and the non-blank cells would contain GCSE grades from A* down to U or National Curriculum levels in the format nx (e.g. 3a). I would need to be able to copy the formula down to other rows. The reason I'm not keen on an array formula is because they can slow things down, as I understand it.

    I'm afraid I don't have a sample worksheet as this is all, for now at least, an emerging plan in my head. I should probably add that the grades will not necessarily increase in value in the range, so we're not looking for the largest.

    Is there a way, or am I going to have to embrace an array formula?
    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.

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Returning the last non-blank value in a horizontal range

    Hi Ali,

    Try:

    =LOOKUP(2,1/(L3:BF3<>""),L3:BF3)

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

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

    Re: Returning the last non-blank value in a horizontal range

    Looks perfect, thanks. Sometimes I just can't see the wood for the trees ...

    I'll have a play with this.

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

    Re: Returning the last non-blank value in a horizontal range

    Great - this seems to work fine on some sample data. Would you mind just explaining to me how it works? I'm sure I'll be able to adapt it for other purposes if I understand exactly what the syntax is asking Excel to do. Thanks in advance!

  5. #5
    Forum Contributor Jack7774's Avatar
    Join Date
    08-31-2012
    Location
    Georgia, US
    MS-Off Ver
    Excel 2010
    Posts
    576

    Re: Returning the last non-blank value in a horizontal range

    Do you want the cell value as in what is in the cell or the cell value as in the cell reference IE AA3?.. oops i posted this way to late.
    Last edited by Jack7774; 04-25-2014 at 01:31 PM. Reason: more replys were available for reading

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

    Re: Returning the last non-blank value in a horizontal range

    Thanks for responding. It's the value I was after, as stated in the thread title and the opening post, not the cell address or reference.

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Returning the last non-blank value in a horizontal range

    Here's a couple of generic "return the last entry in the range" type formulas.

    For the last numeric value in column A:

    =LOOKUP(1E100,A:A)

    For the last text value in column A:

    =LOOKUP("zzzzz",A:A)

    Note that this version does not exclude formula blanks which are text values.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

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

    Re: Returning the last non-blank value in a horizontal range

    Thanks, Tony.

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Returning the last non-blank value in a horizontal range

    Quote Originally Posted by AliGW View Post
    Would you mind just explaining to me how it works? I'm sure I'll be able to adapt it for other purposes if I understand exactly what the syntax is asking Excel to do. Thanks in advance!
    Here's an explanation I wrote for a very similar query based on this formula:

    =LOOKUP(2,1/(A2:A10<>0),A2:A10)

    All the logic of the explanation is basically the same for your application.

    http://www.excelforum.com/excel-form...ml#post3398950

  10. #10
    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,869

    Re: Returning the last non-blank value in a horizontal range

    Many thanks! This is very useful.

  11. #11
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Returning the last non-blank value in a horizontal range

    You're welcome!

+ 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. Sum returning blank cell
    By ukphoenix in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-08-2014, 09:37 PM
  2. Replies: 2
    Last Post: 06-21-2012, 04:51 PM
  3. [SOLVED] Excel 2007 : Returning a value if the first one is blank
    By Gneiss in forum Excel General
    Replies: 5
    Last Post: 04-09-2012, 03:03 PM
  4. Returning a blank if cell is blank
    By Slongy in forum Excel General
    Replies: 3
    Last Post: 06-05-2009, 05:05 AM
  5. vlookup returning blank for blank instead of 0
    By krayziez in forum Excel General
    Replies: 4
    Last Post: 07-31-2008, 11:58 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