dictionarygoogle-sheetslambdaformula

Google Sheets Map LAMBDA function


I have the following data. enter image description here

I need a formula to calculate how many complete shots have been completed by Dominic for example. I have the following formula:

=SUM(MAP('Shot List'!A:A,'Shot List'!D:D,'Shot List'!H:H,LAMBDA(name,shots,complete,IF(name=B7,SUMPRODUCT(shots,complete=TRUE),shots))))

Where A:A is the Sim Pilot, D:D is the number of shots and H:H is whether that shot has been completed. The closest I've got is to count the total number of unchecked boxes for "Dominic" but as you can see the first number is not being counted or rather calculated? Any help would be greatly appreciated. Thanks.


Solution

  • Use query(), like this:

    =query('Shot List'!A3:H, "select A, sum(D) where H = true group by A", 0)
    

    The formula will get the total number of shots for all names that have completed at least one shot.

    See query().