I asked a question on StackOverflow: Google Sheets: Join two tables together
I had to figure out how to join two tables together dynamically. I got an answer from @MattKing on how to solve my problem and his solution worked on the sample data that I had created. However, his solution merges two tables together in a single query()
and I can't understand how that works so I need help understanding that formula. I can't implement it on my actual sheet unless I understand how it works.
Sample sheet where the formula is implemented: https://docs.google.com/spreadsheets/d/1nKQXHwVO8KjsOy5qvjzh-s-YYRUYlAoH-3aXYbwcKsA/edit?usp=sharing
The formula that I need to understand: =ARRAYFORMULA(QUERY({A3:G;{H4:I,IFERROR(ROW(H4:H)/{0,0,0,0}),J4:J}},"select Col1,Col2,SUM(Col3),SUM(Col4),SUM(Col5),SUM(Col6),SUM(Col7) where Col1 is not null group by Col1,Col2 label SUM(Col3)'Impressions',SUM(Col4)'Clicks',SUM(Col5)'Cost',SUM(Col6)'Leads',SUM(Col7)'Offline Leads'"))
Part of that formula that I'm confused about: QUERY({A3:G;{H4:I,IFERROR(ROW(H4:H)/{0,0,0,0}),J4:J}}
I'd appreciate your help in figuring out this awesome formula!