Link to home
Start Free TrialLog in
Avatar of detox1978
detox1978Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Excel: Reference a cell value as part of a Sum()

Hi All,

Is it possible to reference a cell value as part of a sum

e.g.

=SUM(A2:B6)

if CELL A1 have the value B6 in it, is there a way to use this?

i.e.
=SUM( A2:(=A1) )
Avatar of Roy Cox
Roy Cox
Flag of United Kingdom of Great Britain and Northern Ireland image

I don't think that will work, it will error because it will interpret A1 as a String.

You may not be explaining correctly so attach an example workbook.
Avatar of detox1978

ASKER

Book1.xlsxThe green and yellow increases, but the last column will always be grand total on both.   I need to create sum that automatically updates.

User generated image
Give this a try:
=SUM(INDIRECT("B6:" & K2))

Open in new window

Paul
You can use an OFFSET function to create a range to SUM:

=SUM(OFFSET($B$6,0,0,MATCH("Grand Total",A:A,0)-6,MATCH("Grand Total",5:5,0)-2))

Range starts at B6
First MATCH finds row with "Grand Total" in column A and deducts 6 to allow for blank rows above data and row containing "Grand Total". This determines range height (number of rows).
Second MATCH finds column with "Grand Total" in row 5 and deducts 2 to allow for blank column before data and column containing "Grand Total". This determines range width (number of columns).
ASKER CERTIFIED SOLUTION
Avatar of Rob Henson
Rob Henson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Awesome thanks!