SUMIF Variable range of columns

coop123

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

I am struggling to get a SUMIF formula to work. Any help would be very much appreciated.

I have the following code with works,

ActiveCell.FormulaR1C1 = "=SUMIF(R12C3:R702C3,RC10,R12C:R702C)"

The columns always start at row 12, but last row will vary. How do I change R702 to something that is not fixed.

Already in the macro I use ListEnd to define last row in a column, but when I try to add this to the range I cannot get it to work.

Thanks in advance.

Coop123
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
You need to concatenate it in:

Code:
ActiveCell.FormulaR1C1 = "=SUMIF(R12C3:R" & ListEnd & "C3,RC10,R12C:R" & ListEnd & "C)"
 
Upvote 0
Solution
Perfect.

I was putting ListEnd in the wrong place in the formula.

Thank you again.

Coop123
 
Upvote 0

Forum statistics

Threads
1,214,661
Messages
6,120,796
Members
448,994
Latest member
rohitsomani

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