+ Reply to Thread
Results 1 to 22 of 22

Column Lookup last values previous value or values

  1. #1
    Registered User
    Join Date
    08-12-2012
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2007
    Posts
    47

    Column Lookup last values previous value or values

    Hi Group,

    I have found a formula that allows you to look up the last value in a column and return the previous value in that column but it only works for text values not numerical values. Can someone recommend a change or alternate formula for doing the same thing but for numbers?

    Formula used to return second to last value in a column: INDEX(T:T,MATCH(Rept("z",255),T:T,-1) this formula returns the second to last value in col T on my spreadsheet but only works if the value is a letter not a number. Need it to work for numbers or please suggest alternate formula.


    Thanks.

  2. #2
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105

    Re: Column Lookup last values previous value or values

    Yes, please see the link below to explain this formula -
    =INDEX($C$3:$C$12,MATCH(2,1/(B3:B12=E3)))

    https://www.get-digital-help.com/ind...ch-last-value/

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

    Re: Column Lookup last values previous value or values

    Did you try:

    =INDEX(T:T,MATCH(99^99,T:T,-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.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: Column Lookup last values previous value or values

    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: Column Lookup last values previous value or values

    @Ali: think that should be
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    That is, 1 rather than -1.

  6. #6
    Registered User
    Join Date
    08-12-2012
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: Column Lookup last values previous value or values

    Sorry none of those work.

    For clarification, say I have a column of numbers 3,4,6,2,........,4,6,7,8 and I want to return the second to last number in that column, ie 7. What formulas could I use?

    Thanks.
    Last edited by sgrondines; 01-17-2021 at 07:02 PM.

  7. #7
    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,780

    Re: Column Lookup last values previous value or values

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

  8. #8
    Registered User
    Join Date
    08-12-2012
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: Column Lookup last values previous value or values

    See attached file.

    Thanks.
    Attached Files Attached Files

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

    Re: Column Lookup last values previous value or values

    This works in your sample workbook:

    =INDEX(A:A,MATCH(999,A:A)-1)

    The penultimate number value is 3.

  10. #10
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,408

    Re: Column Lookup last values previous value or values

    C3 cell formular
    HTML Code: 
    D3 cell ,Array formular
    HTML Code: 
    E3 cell formular
    HTML Code: 
    F3 cell ,Array formular
    HTML Code: 
    Last edited by wk9128; 01-17-2021 at 07:27 PM.

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

    Re: Column Lookup last values previous value or values

    That’s the last value, not what the OP wants, which is the second to last.

  12. #12
    Registered User
    Join Date
    08-12-2012
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: Column Lookup last values previous value or values

    It works in my example but doesn't in my other spreadsheet. The other spreadsheet has over 2000 entries in the column. Non entries contain a zero while some entries actually have a zero as a value. Plus the reference column is on another worksheet. Does this make a difference?
    Last edited by sgrondines; 01-17-2021 at 07:33 PM.

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

    Re: Column Lookup last values previous value or values

    We can only provide solutions for the data provided. Provide a more realistic dataset.

    I don’t know what you mean by non entries containing 0 - either they are non entries (null or blank) or they aren’t. Do these cells contain formulae?

  14. #14
    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,780

    Re: Column Lookup last values previous value or values

    If the reference column is on another sheet, then you need to adjust the ranges to point to the other sheet.

  15. #15
    Registered User
    Join Date
    08-12-2012
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: Column Lookup last values previous value or values

    See attached

    Yes I have adjusted the ranges to reflect the fact that they are on another sheet. Thanks though.
    Attached Files Attached Files

  16. #16
    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,780

    Re: Column Lookup last values previous value or values

    Yes, that makes a difference. Excel won’t be able to distinguish between a 0 that’s part of the run and 0s after the run.

  17. #17
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: Column Lookup last values previous value or values

    The formula that I provide will return the next to last value regardless of whether the column contains all numeric, all alphanumeric/alphabetic, or a mix of both. Did you try that? See post #4.

  18. #18
    Registered User
    Join Date
    08-12-2012
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: Column Lookup last values previous value or values

    Yes. These values are based on a formula. It is the difference between the last 2 numbers. if the difference is 0 then zero is posted but if there is no value then it prints 0 too. Does that make a difference or should I use IFERROR to eliminate any zero's from a 0-0 calculation but that would eliminate any actual zeros values calculated.

  19. #19
    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,780

    Re: Column Lookup last values previous value or values

    If you eliminate those extraneous zero values with IFERROR, my formula should work.

  20. #20
    Registered User
    Join Date
    08-12-2012
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: Column Lookup last values previous value or values

    Ok, let me change my ss to have no value upon a non-entered cell and see if that works.

  21. #21
    Registered User
    Join Date
    08-12-2012
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: Column Lookup last values previous value or values

    That worked. Thank you very much. I appreciate your patients. I really wish I could find an excel book explaining the various formulas and how to use them better. Everything I have found so far is either too basic or overcomplicated. Thanks again for your help and patients.

    Sebastien.

  22. #22
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,408

    Re: Column Lookup last values previous value or values

    C3 cell formula
    HTML Code: 
    D3 cell , array formula
    HTML Code: 

+ 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. Incrementing numbers based on previous values and text values of a previous cell
    By mauricewsylvester in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-08-2021, 12:34 PM
  2. Replies: 1
    Last Post: 05-12-2020, 08:42 AM
  3. VBA - Creating new column (Columns M) with values based on previous column (Column L)
    By will12321 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-21-2020, 03:36 AM
  4. Replies: 15
    Last Post: 09-09-2015, 08:42 PM
  5. Replies: 11
    Last Post: 07-08-2013, 11:47 AM
  6. Divide values in column by certain previous values
    By keis386 in forum Excel General
    Replies: 6
    Last Post: 04-17-2011, 05:17 PM
  7. lookup values in table, return sum of values from first column
    By owenkam in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 05-10-2010, 05:20 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