+ Reply to Thread
Results 1 to 12 of 12

Return value from last row

  1. #1
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Berlin/Sweden
    MS-Off Ver
    Excel 2010
    Posts
    124

    Return value from last row

    Hi there!

    I'm struggling to with a problem. I have two columns; Column 1 contains an identifying value with has both unique and repeated values and Column 2 has unique values for each cell.

    What I would like to do is to return the last value in the segment of the column 2 for each unique identifier.

    I've attached a sample.

    Appreciate the help!
    Attached Files Attached Files

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Return value from last row

    In F5 cell of Sheet1


    =IFERROR(LOOKUP(2,1/($B$5:$B$39=E5),$C$5:$C$39),"")


    Drag it down..


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

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

    Re: Return value from last row

    Hi.

    Since your values in column B appear to be in ascending order, in F5:

    =LOOKUP(E5,B$5:B$39,C$5:C$39)

    Otherwise, if you cannot guarantee that order:

    =LOOKUP(1,0/(B$5:B$39=E5),C$5:C$39)

    though the first is much more efficient.

    Regards
    Click * below if this answer helped

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

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Return value from last row

    Yet another - try such array formula*
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    and copy down
    *)...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.
    Attached Files Attached Files
    Best Regards,

    Kaper

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

    Re: Return value from last row

    @Kaper

    Volatile?

    Array formula?

    Why?

    Regards

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

    Re: Return value from last row

    Or in F5:

    Please Login or Register  to view this content.
    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.

  7. #7
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Return value from last row

    @XOR LX
    Right.
    In this case - no real need.
    But ... for some users it may be a bit easier to understand how it works. Well, I know that it is personal, but I know a number of users who have contignous problems with LOOKUP understanding, especially in form similar to LOOKUP(1,0/(lookuprange=lookupvalue),returnedvaluerange) .

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

    Re: Return value from last row

    Quote Originally Posted by Kaper View Post
    @XOR LX
    Right.
    In this case - no real need.
    But ... for some users it may be a bit easier to understand how it works. Well, I know that it is personal, but I know a number of users who have contignous problems with LOOKUP understanding, especially in form similar to LOOKUP(1,0/(lookuprange=lookupvalue),returnedvaluerange) .
    Sure, but better to be non-volatile and do some studying than to be volatile yet aware!

    Regards

  9. #9
    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,916

    Re: Return value from last row

    Quote Originally Posted by Kaper View Post
    @XOR LX
    Right.
    In this case - no real need.
    But ... for some users it may be a bit easier to understand how it works. Well, I know that it is personal, but I know a number of users who have contignous problems with LOOKUP understanding, especially in form similar to LOOKUP(1,0/(lookuprange=lookupvalue),returnedvaluerange) .
    In my experience, people who want to understand the syntax of the formula will ask. Making assumptions about their ability to understand is not really our place when we are providing possible solutions ...

  10. #10
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Berlin/Sweden
    MS-Off Ver
    Excel 2010
    Posts
    124

    Re: Return value from last row

    This will do the trick!

    Thanks for the help.

  11. #11
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: Return value from last row

    Quote Originally Posted by XOR LX View Post
    @Kaper

    Volatile?

    Array formula?

    Why?

    Regards

    Couldn't agree more. Array formulas do seem to be " cool" as they say nowadays, and then OP's come back later " My workbook ( with array formulas) is soooooooooooo slow..."

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

    Re: Return value from last row

    Quote Originally Posted by Pepe Le Mokko View Post
    Couldn't agree more. Array formulas do seem to be " cool" as they say nowadays, and then OP's come back later " My workbook ( with array formulas) is soooooooooooo slow..."
    Actually it's the volatility which is the issue here. Kaper's CSE construction will be no less slow to calculate than the non-CSE reciprocal LOOKUP construction, i.e.:

    =LOOKUP(1,0/(B$5:B$39=E5),C$5:C$39)

    In fact, I imagine if anything that the CSE set-up is actually quicker.

    What people don't understand is that the above construction with LOOKUP is also an array formula. It simply does not require CSE to commit it. The same goes for SUMPRODUCT, AGGREGATE, etc., none of which perform any better than the equivalent CSE versions.

    And the worse culprit of all is the sadly commonplace attempt to "avoid" array formulas by inserting one or more additional INDEX functions in appropriate places. Of course, this doesn't mean that it is not an array formula. It is, and in fact will take longer to calculate than the equivalent CSE version by virtue of the extra function (INDEX).

    Regards

+ 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: 2
    Last Post: 05-07-2015, 04:38 PM
  2. Double click row to return data to userform for edit then return back to sheet
    By MattRSJ in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 01-31-2014, 06:05 AM
  3. Replies: 12
    Last Post: 10-10-2013, 10:02 AM
  4. [SOLVED] Return value if within range, return multiple values if ranges overlap
    By cde1983 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-17-2013, 06:16 AM
  5. Replies: 4
    Last Post: 03-13-2013, 12:38 PM
  6. Replies: 6
    Last Post: 10-11-2012, 02:39 PM
  7. Search...Return...give info based on the return address
    By deek1004 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-11-2012, 03:36 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