SUMIF using named range

coop123

Board Regular
Joined
Dec 18, 2018
Messages
66
Office Version
  1. 365
Hi

I am trying to add a sumif formula to an existing macro. I am wanting to sum all minus values and all positive values. The start and end of the range being summed will change each time report is downloaded.

I have got to the top of my column of data as part of existing macro.

Dim Rng As Range
Set Rng = ActiveCell.End(xlDown)

Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveCell.Resize(4, 1).Select
Selection.Delete Shift:=xlUp

ActiveCell.Resize(1, 1).Select

ActiveCell.Offset(1, 1).Select

ActiveCell.FormulaR1C1 = "=SUMIF(Rng:R[-2]C2,"">0"",Rng:R[-2]C)"

Actual SUMIF formula is =SUMIF(B23:B40,"<0",B23:B40). Range B23:B40 will vary each time report is run.

Any help to correct my formula would very much be appreciated.

Thank you

Coop123
 
You are welcome.
Glad I was able to help!
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,215,703
Messages
6,126,320
Members
449,308
Latest member
Ronaldj

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