Google-sheets – How to consolidate information from different sources in Google Sheets

google sheetsworksheet-function

So I have a Google Sheet with several sheets (tabs) in it, like so:

Sheet 1 - Weapons                Legend
A       B       C       D        A = Date
5/3     John    Sword   10       B = From
6/3     Jack    Sword   10       C = For What
7/3     Jill    Mace    20       D = Amount

Sheet 2 - Supplies
A       B       C       D
5/3     Biff    Wood    20
7/3     Kent    Wood    20
8/3     Dann    Iron    40

Sheet 3 - Accessories
A       B       C       D
5/3     Luke    Ring    5
6/3     Gaia    Ring    5
8/3     Fonz    Belt    15

Now, the thing is, I want a Sheet 4 – Transactions.

  • The numbers in Sheet 1 & Sheet 3 are 'Inflows' (sales made by shop), whereas the numbers in Sheet 2 are 'Outflows' (materials bought by shop).

I need something like this:

Sheet 4 - Transactions            (Opening Balance - 100)
A        B        C        D        E
5/3      John     Sword    10       110
5/3      Biff     Wood     (20)     90
5/3      Luke     Ring     5        95
6/3      Jack     Sword    10       105
6/3      Gaia     Ring     5        110
7/3      Jill     Mace     20       130
7/3      Kent     Wood     (20)     110
8/3      Dann     Iron     (40)     70
8/3      Fonz     Belt     15       85

To explain Sheet 4:

  • Col A – Date
  • Col B – Whom
  • Col C – For What
  • Col D – Amount
  • Col E – Balance (computed)

I figure I need to put together some fancy query perhaps? A way to consolidate multiple queries?

I'd appreciate if you could provide your logic along with the code (if any), or even if there's a smarter way to do this. The end goal being to track the history of the money bag held by the shop.

Best Answer

By using array formulas with embedded arrays you could append the three ranges in one. I.E.

=ArrayFormula(Sheet1!A1:D4;{Sheet2!A1:C3,Shee2!D1:D3*-1};Sheet3!A1:D4})

Then you could add the balance column next to the resulting range.