Search code examples
google-sheetspivotgoogle-sheets-formulaarray-formulasgoogle-sheets-query

Sheets Formula Help: Combine all matching values together (A,B,C, not A+B+C), if column title matches


(Google Sheets, Formula/equation help, running on Windows 10, comparing 2 sheets within one google sheet doc)

Hello,

I need to mass add cell values together IF they match column A value. I need when the column A value is matched, column H all matching values need to populate into one cell on another sheet. I am not sure what equation to use to do this as column H is numbers and cannot use Sumifs.

Second time poster, so have to attach link to google sheets screenshot.

1


Solution

  • try:

    =ARRAYFORMULA({QUERY(QUERY({Sheet1!A2:A, Sheet1!H2:H}, 
     "select Col1,count(Col1) where Col1 is not null group by Col1 pivot Col2"), 
     "select Col1 offset 1", 0), SUBSTITUTE(REGEXREPLACE(TRIM(
     TRANSPOSE(QUERY(TRANSPOSE(IF(QUERY(QUERY({Sheet1!A2:A, Sheet1!H2:H}, 
     "select count(Col1) where Col1 is not null group by Col1 pivot Col2"), 
     "offset 1", 0)="",,QUERY(QUERY({Sheet1!A2:A, Sheet1!H2:H&","}, 
     "select count(Col1) where Col1 is not null group by Col1 pivot Col2"), 
     "limit 0", 1))),,9^9))), "\s|,$", ), ",", ","&CHAR(10))})
    

    enter image description here

    spreadsheet demo