Summing two running totals

pedro-egoli

Well-known Member
Joined
Apr 25, 2004
Messages
1,217
Office Version
  1. 2016
Platform
  1. Windows
Following on from earlier query which Barry Houdini answered for me I now want to total the sub totals for Visa and Cash transactions.

Also if possible would like to hide the previous individual sub totals for Visa and Cash transaction once a new sub total is shown.

In the spreasheet below cells in Column G are the ones I want to show the total of sub totals in column H & I.
In this example i want to hide prior results shown in cells H15:H17 and I19 once a new total is shown in G18 and I20, with the same to continue all way down.

Formula was working well until cell G19, so far as totalling the sub totals went but in cell I got a Circular Reference reminder.
Budget actuals trip itinerary etc.xls
GHIJK
14$14,283TotalofvisaTotalCashVisaCash
15-$239-$239 -$239 
16-$330-$330 -$91 
17-$577-$577 -$246 
18-$727-$727 -$150 
19-$330 -$40 -$40
20 -$190 -$150
BUDGET 2009 TRIP


Assistance once again appreciated.

Pedro
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Excel Workbook
DEF
16
17BUDGET5000
18METHODperiod 1
19cash265
20cash65
21cash86
22visa854
23cash125
24cash365
25visa4523
26visa3698
27visa1256
28cash321
29cash2563
30
31
32VISA161
33CASH497
34
Sheet1


This is the data before i run the macro, it can be tidied to suit whatever your layout is and i've run it twice so the totals at the bottom of the first sheet are from last run. If you count the transactions in the box then compare after i run the macro in the second image.....works a treat :)

Excel Workbook
DE
17BUDGET5000
18XXXXXX
19cash
20cash
21cash
22visa
23cash
24XXX
25visa
26XXX
27visa
28XXX
29cash
30
31
32VISA10331
33CASH3790
34
Sheet1
 
Upvote 0
What your not seeing, is i had the macro recorder going and wrote a sumif for each category, and got the totals, then i did a copy and paste values only in the totals box before deleting the cash or card, all while the macro was recording and it does what you wanted. Heres the code,

Sub Macro9()
'
' Macro9 Macro
'

'
ActiveCell.FormulaR1C1 = "=SUMIF(R[-13]C[-1]:R[-3]C[1],RC[-1],R[-13]C:R[-3]C)"
Range("E33").Select
ActiveCell.FormulaR1C1 = "=SUMIF(R[-14]C[-1]:R[-4]C[1],RC[-1],R[-14]C:R[-4]C)"
Range("E32:E33").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("E19:E29").Select
Selection.ClearContents
Range("D31").Select
End Sub

but if you don't know how to change it just use the macro recorder while your making up your sheet

hope it helps
 
Upvote 0
Thanks Scotty,
Before I start to try and follow your instructions must mention that in my spreadsheet that relate to individual items (C15:F20) come initially from another sheet and are transferred via formula to either column H or I.
This also refers to Column B (visa or Cash)
In your example you have just entered figures into column K and I am trying to get my head around how to handle your suggestion within the framework of my sheet.

Might be best if I display my full sheet again so you can see what I mean

Would also mention my understanding macros is not very good.

Pedro
 
Upvote 0
Upvote 0

Forum statistics

Threads
1,214,923
Messages
6,122,283
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top