i need to calculate paymant of this people in the same week like you see in this spreadsheet https://docs.google.com/spreadsheets/d/1fHEtOFxZeRjJ07duCxxhUwUL_1G3BUrvKRMYjT9_OmM/edit#gid=91744412 I used WEEKNUM formula to extract the number of week using the data in column A ..for example "anselmi" earned 16 in week 24...... thanks

# Best How To :

I made a extra sheet in the spreadsheet you shared, called 'JP'. In cell A1 I entered this formula:

```
=ArrayFormula(query({weeknum(Foglio2!A2:A)\Foglio2!B2:D}; "select Col2, Col1, sum(Col3) where Col2 <>'' group by Col2, Col1 label Col2 'Name', Col1 'Weeknumber', sum(Col3) 'Total'"))
```

This formula outputs three columns: one column with the names, a second one with the weeknumber and a third column with the sum. This ouput will auto-update when new rows are added in Foglio2.

See if that works for you ?