Making the criteria in a SUMIF function relative to the active cell

kays23

New Member
Joined
Sep 17, 2019
Messages
2
=SUMIF($C:$C,$C$4,D:D)

The criteria in this formula always needs to reference the cell "ActiveCell.Offset(-1, -1)". Is there a way to do this through VBA?

SUMIF(C3,R4C3,C) This is what is looks like on VBA.


Thanks
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Welcome to the forum!

Hi @★ kays23 , I don't understand the formula, it seems that the formula is in the same column D. That is a circular reference error.
You could explain how you have the data and what you expect from the result.
 
Upvote 0
Welcome to the forum!

Hi @★ kays23 , I don't understand the formula, it seems that the formula is in the same column D. That is a circular reference error.
You could explain how you have the data and what you expect from the result.


I expect the macro to be able to input the sumif formula referencing the range as column $C, the criteria as $ActiveCell.Offset$(-1,-1) and the sum range as the column of the active cell so D but not locked as the sum range will change.
Hope this makes sense, When I enter this formula it returns the correct amount and does not produce an error
 
Upvote 0
Just to understand, you could give an example of how your data is and where you want to put the formula.
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,732
Members
448,987
Latest member
marion_davis

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