tags:

views:

339

answers:

3

How do I sum from whats in B2 to C2 ?

B2 = A10 or just 10 (preferred)
C2 = A25 or just 25 (preferred)

Normally you would just use SUM(A10:A25), but the values in B2 and C2 are not fixed, they change based on input. I can use MATCH to find the numbers, but how do I tell SUM to use those numbers ? The values to sum are always in the same column.

A: 

Use the INDIRECT() function. You pass it a string that is a range, which allows you to have a dynamic range based on input.

Neil Barnwell
bah... beaten by seconds ;-)
Eoin Campbell
+1  A: 

You want to specify Cell Co-ordinates in the value of a Cell ?

Is that what you're getting at ?

Try Setting

B1 = "A10"
C1 = "A25"
D1 = =SUM(INDIRECT(B1):INDIRECT(C1))
Eoin Campbell
+1  A: 

You can use the INDIRECT function for this, e.g.

=SUM(INDIRECT(B2):INDIRECT(C2))

if you can live with entering the entire cell name (A10, A25).

Or to just have the numbers in B2 and C2, you could use

=SUM(INDIRECT(ADDRESS(B2;1)):INDIRECT(ADDRESS(C2;1)))

(Hope I got the columns and rows in the right order!)

Makis