Sum a range of cells defined by a string

Nerdio

New Member
Joined
Dec 5, 2011
Messages
14
I have a table with a number of columns. I want to sum the values in one column over a range of rows determined by values in another column.

For example,

I have a worksheet called Fund

On a different worksheet (Calculations)
I find the minimum value in Column A and get a row number
I find the maximum value in Column B and get a row number

Say Minimum is on row 4 and maximum is on row 6

I want to perform this SUM.

SUM(Fund!$B$4:Fund!$B$6)

This works fine if I enter it literally, but of course I want to use the Minimum and Maximum values I found earlier. So, just to get this working and understand the steps, On my Calculations worksheet I have created this in Cell A1

Fund!$B$4:Fund!$B$6

This is a string (text), so to do the same sum as before I have used this formula

SUM(INDIRECT(A1))

This fails with a #REF! error.

This gives me the same error

=SUM(INDIRECT("Fund!$B$4:Fund!$B$6"))

The problem must be to do with the way I am expressing the range of cells for INDIRECT, but the range is the same as for the example where I just use SUM.

What am I doing wrong?
Thank you
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
I am unsure if I got this correctly.
so My understanding is that you want to add minimum Value from column A and Maximum Value from column B all from Calculation worksheet.

So why not use:

Excel Formula:
=SUM(MIN(Calculations!A1#);MAX(Calculations!B1#))

where:
Calculation sheet Example:
1707561762111.png


and Fund sheet formula:
1707561787924.png


you could also bypasss the sum function entirely:
Excel Formula:
=MIN(Calculations!A1#)+MAX(Calculations!B1#)
1707561833847.png
 
Upvote 0
Book1
ABC
178
22123
392
4133
51215
61442
7617
8117
Fund
Cell Formulas
RangeFormula
C8C8=SUM(A4:B6)


Book1
A
1117
Calculations
Cell Formulas
RangeFormula
A1A1=SUM(INDIRECT("Fund!A"&XMATCH(MIN(Fund!A1:A7),Fund!A1:A7,0,1)&":B"&XMATCH(MAX(Fund!B1:B7),Fund!B1:B7,0,1),TRUE))


Excel Formula:
=SUM(INDIRECT("Fund!A"&XMATCH(MIN(Fund!A1:A7),Fund!A1:A7,0,1)&":B"&XMATCH(MAX(Fund!B1:B7),Fund!B1:B7,0,1),TRUE))

Is that what you need
 
Upvote 0
Solution
I am unsure if I got this correctly.
so My understanding is that you want to add minimum Value from column A and Maximum Value from column B all from Calculation worksheet.

So why not use:

Excel Formula:
=SUM(MIN(Calculations!A1#);MAX(Calculations!B1#))

where:
Calculation sheet Example:
View attachment 106634

and Fund sheet formula:
View attachment 106635

you could also bypasss the sum function entirely:
Excel Formula:
=MIN(Calculations!A1#)+MAX(Calculations!B1#)
View attachment 106636
Not quite. I don't think my question was completely clear.
I want to sum the range on the Fund worksheet between the minimum value in Column A of that worksheet and the maximum value in column A of that worksheet.

So, if my data looks like this on the Fund Worksheet

1707562752333.png

The minimum value in Column A is in Row 4. The maximum value in Column A is in Row 6

I want to sum the values from B4 to B6. Effectively this

SUM(Fund!$B$4:Fund!$B$6)
 

Attachments

  • 1707562597407.png
    1707562597407.png
    3.7 KB · Views: 6
  • 1707562659527.png
    1707562659527.png
    4.1 KB · Views: 7
  • 1707562690706.png
    1707562690706.png
    3.8 KB · Views: 6
  • 1707562699522.png
    1707562699522.png
    3.8 KB · Views: 6
Upvote 0
Book1
ABC
178
22123
392
4133
51215
61442
7617
8117
Fund
Cell Formulas
RangeFormula
C8C8=SUM(A4:B6)


Book1
A
1117
Calculations
Cell Formulas
RangeFormula
A1A1=SUM(INDIRECT("Fund!A"&XMATCH(MIN(Fund!A1:A7),Fund!A1:A7,0,1)&":B"&XMATCH(MAX(Fund!B1:B7),Fund!B1:B7,0,1),TRUE))


Excel Formula:
=SUM(INDIRECT("Fund!A"&XMATCH(MIN(Fund!A1:A7),Fund!A1:A7,0,1)&":B"&XMATCH(MAX(Fund!B1:B7),Fund!B1:B7,0,1),TRUE))

Is that what you need

Yes, that did exactly what I wanted. Thank you.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

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