Google-sheets – Pull data when cell value is selected

formulasgoogle sheetsgoogle-sheets-arrayformulagoogle-sheets-queryvlookup

I am Trying to pull data from part of a sheet to another part depending on if dirt level 22 value is filled in. Please see attached Picture, basically, the bottom section pulls data from rows above depending on if dirt level 19, 20, 21 or 22 is displayed. I have only used 22 in the image.

Timesheet example

Best Answer

  • paste in AH27 cell:

    =ARRAYFORMULA(QUERY(IF(O7:O21=22, VLOOKUP(22, O7:X21, {3,4,5,6,7,8,9,10}, 0), ), 
     "where Col8 is not null", 0))

  • paste in AT27 cell:

    =ARRAYFORMULA(QUERY(IF(O7:O21=22, 
     Y7:Y21+AC7:AC21+AE7:AE21+AG7:AG21+AI7:AI21+AK7:AK21, ), "where Col8 is not null", 0))