Add Sum total only when reaching bottom of row based on value in another column

TTXS

New Member
Joined
May 15, 2024
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hello, I have a sheet with column A has two values, say Incoming and Outgoing. I have column B with the numbers. I want to add Total Incoming and Total Outgoing in column C. Incoming/Outgoing is sorted. So let’s say I have 10 rows of incoming value, then I want total in cell C11 (first row is the header). Then I have 5 rows of Outgoing, then the total would be in cell C16.

The thing is the number of incoming/outgoing could change daily. So tomorrow the total may need to be cell 20 and 25. How can I use a VBA to auto check the last row with Incoming or Outgoing in column A and create a Sum total? Thanks
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
welcome to the forum. I think it would help the forum (especially me) if you provided a sample of what your data looks like on one day. Also, expected results in column C would be helpful.
 
Upvote 0
First, welcome.

Are you trying to create a running total of Incoming and Outgoing? I would use Sumifs and combine it with an IF statement to only give you a summary in Column B when you need it. I wish you could post a sample of the sheet.

Maybe something like pasted in Cell B2:
=IF($A2<>$A3,SUMIFS($C$1:$C2,$A$1:$A2,$A2),"")
 
Upvote 0
maybe this:

Book1
ABC
1TypeAmtTotal
2Incomming22 
3Incomming23 
4Incomming18 
5Incomming28 
6Incomming16 
7Incomming12119
8Outgoing29 
9Outgoing22 
10Outgoing17 
11Outgoing2088
12Incomming12 
13Incomming23 
14Incomming2459
15Outgoing21 
16Outgoing29 
17Outgoing21 
18Outgoing25 
19Outgoing28124
Sheet2
Cell Formulas
RangeFormula
C2:C19C2=IF(A3<>A2,SUM($B$2:B2)-SUM($C$1:$C1),"")
 
Upvote 0
Thank you. That’s what I need - the IF statement of A3<>A2. I didn’t think of that, but it worked for my purpose. Thank you!
 
Upvote 0
Thank you. That’s what I need - the IF statement of A3<>A2. I didn’t think of that, but it worked for my purpose. Thank you!
My pleasure.
Best Wishes!
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,151
Members
453,021
Latest member
Justyna P

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