Sum of cells in intersection of current column with a named range

rhayward

New Member
Joined
May 4, 2013
Messages
7
I have a range called MyRange.

I want to put a formula in the cells of a row, somewhere below MyRange that gives the SUM() of cells in MyRange that intersect with the column of the current cell.


MyRange.JPG


Is there some clean way of doing this, using names, and maybe the COLUMN() function, instead of specific addresses in the formula?

Regards
Richard
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Try this, copied across.

20 03 18.xlsm
BCDEFG
1
2667601
3355903
4586224
594311-20
6
7
8232321183-12
Sum
Cell Formulas
RangeFormula
B8:G8B8=SUM(INDEX(MyRange,0,COLUMNS($B8:B8)))
Named Ranges
NameRefers ToCells
MyRange=Sum!$B$2:$G$5B8:G8
 
Last edited:
Upvote 0
Another option
+Fluff.xlsm
BCDEFG
1
2667601
3355903
4586224
594311-20
6
7
8232321183-12
Import
Cell Formulas
RangeFormula
B8:G8B8=SUM(MyRange INDEX(B:B,0))
 
Upvote 0
Over thinking things again :(
 
Upvote 0
You could use
=SUM(INDEX(myRange, 0, COLUMN()-COLUMN(myRange)+1))

to get your sum.

To return the column of the cell that holds the formula as a range, you could us =INDEX(1:1048576,0,COLUMN()), which will cause a circular reference error.
 
Upvote 0
Without involving myself in vba, there is no built in function that returns a range corresponding to the column of the cell in which the function is used?
Like this?

20 03 18.xlsm
BCDEFG
1
2667601
332005903
4586224
594311-20
6
7
82321821183-12
Sum
Cell Formulas
RangeFormula
B8:G8B8=SUM(INDEX(MyRange,0,MATCH(COLUMN(),COLUMN(MyRange))))
Named Ranges
NameRefers ToCells
MyRange=Sum!$B$2:$G$5B8:G8



BTW, I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version.
 
Upvote 0

Forum statistics

Threads
1,214,914
Messages
6,122,211
Members
449,074
Latest member
cancansova

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