Return the last value

Hi there

I need a formula that finds the value of the 'join' column and returns the value of the 'total' column but return the last value according to the date.


Best Answer

  • Kelly Moore
    Kelly Moore ✭✭✭✭✭✭
    Answer ✓

    Hey @Diego ELvira

    Sorry I misunderstood. So you want the max date per the the JOIN. To do this, you will need a helper column to first find the various Max dates. You will use this to then find Total per Join.

    IsMax checkbox Helper column

    =IF(Date@row = MAX(COLLECT(Date:Date, Date:Date, ISDATE(@cell), JOIN:JOIN, <>"", JOIN:JOIN, JOIN@row))), 1)

    The formula you requested then becomes

    =INDEX(COLLECT(TOTAL:TOTAL, JOIN:JOIN, JOIN@row, IsMax:IsMax, 1), 1)


    Will this work for you?

    Kelly

Answers

  • Kelly Moore
    Kelly Moore ✭✭✭✭✭✭

    Hey @Diego ELvira

    If I understand, you're looking for a formula that returns the TOTAL of the last date. This is the syntax if your formula is on the same sheet

    =INDEX(TOTAL:TOTAL,MATCH(MAX(DATE:DATE), DATE:DATE, 0))


    Will this work for you?

    Kelly

  • Diego ELvira
    edited 04/09/24

    @Kelly Moore What happens is that: I have a database with different IDs, so the 'join' column can contain, for example 20455-20-6-2, etc. What I need is to look for the cell of the 'join' column and return the last data according to the last date.

    I had tried combining vlookup with other formulas but I haven't solved it.

  • Kelly Moore
    Kelly Moore ✭✭✭✭✭✭
    Answer ✓

    Hey @Diego ELvira

    Sorry I misunderstood. So you want the max date per the the JOIN. To do this, you will need a helper column to first find the various Max dates. You will use this to then find Total per Join.

    IsMax checkbox Helper column

    =IF(Date@row = MAX(COLLECT(Date:Date, Date:Date, ISDATE(@cell), JOIN:JOIN, <>"", JOIN:JOIN, JOIN@row))), 1)

    The formula you requested then becomes

    =INDEX(COLLECT(TOTAL:TOTAL, JOIN:JOIN, JOIN@row, IsMax:IsMax, 1), 1)


    Will this work for you?

    Kelly

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!