formula like MAX, but that grabs the top three?

02/27/21
Answered - Pending Review

I have a sheet that collects project updates per project, and I want to surface the most recent three updates per project for a report. So the data is really simple, there is a date and an incrementing autonumber, so I can use either of those for the metric.

Table has these fields, so pretty basic stuff:

ProjectName; Update Text; ID; Date

When I have done this in SQL, it is a matter of getting the MAX, for a project, then getting the MAX for a project where ID is less than the MAX, and then getting the MAX for a project where ID is less than that second-Max. That get the top three. And that's effectively a query in a query in a query.

Is there a way to pull this off in Smartsheet?

Answers

  • Bassam KhalilBassam Khalil ✭✭✭✭✭

    Hi @James Keuning 

    Hope you are fine, you can do that by adding the system column "Modified" which register the last date for modification then you can use the following formulas to collect the latest 3 modefication and use that with Vlookup to collect your data:

    The Last of the 3 =DATE(VALUE(YEAR(MAX(Modified:Modified))), VALUE(MONTH(MAX(Modified:Modified))), (-2 + VALUE(DAY(MAX(Modified:Modified)))))

    The next = DATE(VALUE(YEAR(MAX(Modified:Modified))), VALUE(MONTH(MAX(Modified:Modified))), (-1 + VALUE(DAY(MAX(Modified:Modified)))))

    The first = DATE(VALUE(YEAR(MAX(Modified:Modified))), VALUE(MONTH(MAX(Modified:Modified))), (VALUE(DAY(MAX(Modified:Modified)))))

    PMP Certified

    [email protected]

    www.mobilproject.it

    ☑️ Are you satisfied with my answer to your question? Please help the Community by marking it as an ( Accepted Answer), and I will be grateful for your "Vote Up" or "Insightful"

Sign In or Register to comment.