Search code examples
indexingfiltergoogle-sheetsmatchgoogle-query-language

Google Sheets - Return all cells based on nearby reference cells/multiple criteria


I'm attempting to create a table which shows averages based on multiple criteria of nearby cells.

The best way to explain is with my sample sheet (with edit permission): https://docs.google.com/spreadsheets/d/1R3WSa2B0_wzOsp4Z7ktVy_2UVG2tVgo0DK1hehMNW2Q/edit?usp=sharing

The closest I've gotten was to utilize Index Match, though that only returns a value based on a single criteria:

=index(C1:C10, match("Joey",C1:C10,0)+2)

But of course I need to reference multiple cells/criteria (looking at the "Assigned Person" and the "Job Type"... THEN pulling the value of the cell labeled "Days")

I've also tried a pivot table, HLOOKUP, Filter, and Query, but can't seem to get the multiple criteria AND cell reference in there.


Solution

  • Maybe try

    =iferror(average(filter(offset($C$2:$C$10, 2, 0), $C$2:$C$10=$A15, offset($C$2:$C$10, 1, 0)=B$14)), "-")
    

    in B15 and fill down and to the right.