Search code examples
google-sheetssumifsarray-formulas

How to apply google spreadsheet arrayformula for picking out the earliest date in a mixed set of values?


I need to somehow cross data from 2 columns with different criteria: in the first one I have worker's id, in the other - their dates of activities. The idea is to display the earliest date for a selected worker. I tried to organize it via SUMIFS but it only shows one correct date for a worker which started on the absolutely earliest date from the whole range. See my sample spreadsheet with those formulas here: https://docs.google.com/spreadsheets/d/1somY2LxNpQic1vclubw-DV9h0Jo3lqcwUuqrI-Praw0/edit?usp=sharing

In other words I'm looking for a formula that will sort out only dates of an appropriate (chosen) worker and display the minimal (earliest) date from it.


Solution

  • Try:

    =query(A1:B8; "select A, min(B) group by A";1)
    

    See also cell G1 in the spreadsheet you shared.

    Alternatively, try:

    =vlookup(D2; sort(A2:B8; 2;1); 2; 0)