Search code examples
google-sheets-formula

Get newest date in Sheet


i have a sheet with two tabs. In the first tab, i can select a site and i have a list of types. I have a second tab with many datas from each type (date, year, month week, and site attached to a type).

I would like in the first tab write a formula to automatically get the newest date of the type depending to the selected site.

I'm not good with formulas but i tried to write one, this one =IF((AND(C1=DATA!F:F),(B3=DATA!E:E)),LARGE(DATA!A:A),"") but i don't have result.

Anyone can help me with my problem please ? This is the link of my Sheet.


Solution

  • enter image description here

    =INDEX(SORT(FILTER( DATA!A:A; DATA!F:F = $C$1; DATA!E:E = $B3); 1; FALSE);1)
    =INDEX(SORT(FILTER( DATA!A:A; DATA!F:F = $C$1; DATA!E:E = $B4); 1; FALSE);1)
    

    INDEX(array, [row])

    Index gets the nth value in an array, when you pass in the value 1, it will get the top most value.

    I created a sorted array by using the FILTER function. and the SORT function. I sorted it descending and only returned the dates in the FILTER function.