Formula in macro

sujittalukde

Well-known Member
Joined
Jun 2, 2007
Messages
520
I am running a macro which calculated subtotal and total but the GRAND TOTAL is taking the subtotal figure also. So I wnat to set the GRAND TOTAL formula in the macro itself so that GRAND TOTAL comes corrctly?

A picture is attached to clarify the matter.
Book8
ABCD
1A2
2B3
3C4
4AA5
5D6
6E7
7F8
8AA9
9G10
10H11
11I12
12AA13
13GRAND TOTAL63=((SUM(B1:B12))-(SUMIF(A1:B12,"aa",B1:B12)))
14This calculation has to be made in macro
Sheet1


How this can be done?
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
THe macro I have use the sum function. I have made some modification to it so the GRAND TOTAL is changing So I need to change the formula of Grand Total
 
Upvote 0
Perhaps

Code:
Range("B13").Formula = "=SUM(B1:B12)-SUMIF(A1:A12,""aa"",B1:B12)"
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,334
Members
449,077
Latest member
Jocksteriom

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