+ Reply to Thread
Results 1 to 4 of 4

Find second last/previous value in the row

  1. #1
    Registered User
    Join Date
    12-12-2015
    Location
    Latvia
    MS-Off Ver
    MS Office 2016
    Posts
    13

    Question Find second last/previous value in the row

    Hello there.

    I am struggling with the problem I can't resolve very many hours, read all articles, tried again and again (using DAX and Excel formulas) and nothing. I hope somebody can crack this nut.


    Here is the problem:

    The goal is to get the second last or previous value in the last row for each unique client id (clients can be repeated) based on date and compare it in another column. So far I have used =LOOKUP(2;1/([id]=[@[id]]);[amount]) formula to get the last value in one column and then used pivottable to quickly see each client last value. Now I am in the situation I need to compare the last and the second last value to compare both values. I tried to make some modifications and even tried to write with DAX but I am just out of idea, because nothing works.

    One of solution is create advanced formula in data sheet or another create DAX formula. So it doesn't matter to me as data is formatted as table.

    Below I have attached the file with sample. And highlighted cells for the first sample.

    Very appreciated any help. And I hope users will find something useful.
    Attached Files Attached Files

  2. #2
    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,719

    Re: Find second last/previous value in the row

    Try this:

    =LOOKUP(2,1/(([client_id]=[@[client_id]])*([app_date]=LARGE(IF([client_id]=[@[client_id]],[app_date]),2))),[loan_amount])
    Attached Files Attached Files
    Last edited by AliGW; 03-06-2022 at 03:38 AM. Reason: Workbook attached.
    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.

  3. #3
    Registered User
    Join Date
    12-12-2015
    Location
    Latvia
    MS-Off Ver
    MS Office 2016
    Posts
    13

    Re: Find second last/previous value in the row

    This is...absolutely....mind-blowing.I am actually impressed. It's works. THANK YOU!!

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

    Re: Find second last/previous value in the row

    Just applied logic! You're welcome.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

+ 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] Find previous and next value
    By Berna11 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-25-2019, 09:35 AM
  2. [SOLVED] VBA Find previous value
    By PaulaGon in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-26-2018, 11:53 AM
  3. Find previous occurance
    By simonwait in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-07-2016, 11:12 PM
  4. Find previous occurrence of a value in a row and get value in same row
    By kalli in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-08-2013, 10:48 AM
  5. [SOLVED] Find certain word, copy and paste cell in previous row if previous row is blank
    By steven_e in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-19-2013, 12:53 PM
  6. [SOLVED] Find last previous non blank value and summarise previous 6 months
    By Lady_Shaz in forum Excel General
    Replies: 7
    Last Post: 12-11-2012, 06:20 AM
  7. Find the previous row selected?
    By ballack in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-15-2007, 12:50 AM

Tags for this Thread

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