+ Reply to Thread
Results 1 to 8 of 8

Search for last cell in range containing data, get value from cell above

  1. #1
    Forum Contributor
    Join Date
    12-06-2012
    Location
    sacramento,calif
    MS-Off Ver
    Excel 2010
    Posts
    217

    Search for last cell in range containing data, get value from cell above

    I need to find the last cell in range AM3:BD3 with data (text or number) and get the value from the cell above.
    So if the last cell with data in range AM3:BD3 is AP3, get value from cell AP2.

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Search for last cell in range containing data, get value from cell above

    Would there be gaps in the data (i.e. blank cells mid range)?

  3. #3
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Search for last cell in range containing data, get value from cell above

    try this array formula
    =INDEX(2:2,MAX((AM3:BD3<>"")*COLUMN(AM3:BD3)))
    Confirm with ctrl+Shift+Enter and not just Enter

    or this non-array formula
    =LOOKUP(2,1/(AM3:BD3<>""),AM2:BD2)
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  4. #4
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Search for last cell in range containing data, get value from cell above

    If its VBA code you are after, try:

    Please Login or Register  to view this content.
    Regards,
    Rudi

  5. #5
    Forum Contributor
    Join Date
    12-06-2012
    Location
    sacramento,calif
    MS-Off Ver
    Excel 2010
    Posts
    217

    Re: Search for last cell in range containing data, get value from cell above

    Quote Originally Posted by RudiS View Post
    If its VBA code you are after, try:

    Please Login or Register  to view this content.
    no, just a formula but thanks for that option.

  6. #6
    Forum Contributor
    Join Date
    12-06-2012
    Location
    sacramento,calif
    MS-Off Ver
    Excel 2010
    Posts
    217

    Re: Search for last cell in range containing data, get value from cell above

    Quote Originally Posted by Ace_XL View Post
    try this array formula
    =INDEX(2:2,MAX((AM3:BD3<>"")*COLUMN(AM3:BD3)))
    Confirm with ctrl+Shift+Enter and not just Enter

    or this non-array formula
    =LOOKUP(2,1/(AM3:BD3<>""),AM2:BD2)
    Yes they both work, I don't like using arrays so I appreciate the non-array solution, I am curious if you can explain how this formula works? =LOOKUP(2,1/(AM3:BD3<>""),AM2:BD2)

  7. #7
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Search for last cell in range containing data, get value from cell above

    Well explained in post #4 of this thread

    http://www.excelforum.com/excel-gene...-in-range.html

  8. #8
    Forum Contributor
    Join Date
    12-06-2012
    Location
    sacramento,calif
    MS-Off Ver
    Excel 2010
    Posts
    217

    Re: Search for last cell in range containing data, get value from cell above

    Quote Originally Posted by Ace_XL View Post
    Well explained in post #4 of this thread

    http://www.excelforum.com/excel-gene...-in-range.html
    excellent, thanks

+ 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. Creating search box in cell - Currently using Macro 'Range to search' *HELP*
    By jacko058 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-14-2014, 05:24 AM
  2. [SOLVED] Formula to count frequency of data in cell range based on data in different cell range
    By jrosko1 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-12-2013, 09:47 AM
  3. Replies: 4
    Last Post: 05-12-2011, 02:25 PM
  4. Replies: 8
    Last Post: 03-03-2011, 03:28 PM
  5. Replies: 2
    Last Post: 05-30-2007, 01:49 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