简体   繁体   中英

Sum rows if header and first column meet criteria in Google Sheets

I have a table with first row as header and first column as week number, I need to sum all the data on every week that meets the criteria depending on the header name.

This formula only filter by header and week, but I can't summarize the data, I would like that the formula is "dynamic" because the header name section can change:

=QUERY(TRANSPOSE(A1:AA23),"SELECT * WHERE Col1 = 'MO'",1)

This is an example spreadsheet, at the end is the desired result: LINK TO EXAMPLE SHEET

在此处输入图像描述

use:

=INDEX(QUERY(SPLIT(FLATTEN(IF(D2:24="",,D1:1&"×"&A2:A24&"×"&D2:24)), "×"), 
 "select Col1,sum(Col3) 
  where Col1 matches 'INDIRECTO|M.O.' 
  group by Col1 
  pivot Col2"))

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM