Using variables as parameters of function

  • Thread starter Thread starter R
  • Start date Start date
R

R

Hi guys,

I got a little problem with my Excel function and cannot solve the
following:

Let's say

A1 shows "D1". D1 contains 10.
A2 shows "D2". D2 contains 5.

Now I am trying to get Excel sum these two - like SUM (%A1:%A2).
I know "%" are incorrect here but I am trying to stress that A1 and A2 are
not fixed parameters of the SUM function but only variables (they should
read A1 which links to D1 and get the value of D1 which is 10)

How do I do the function then?

Of course, when I go SUM (A1:A2) now, it gives me 0.
I believe there is an operator to show Excel that both A1 and A2 are the
variables.

THANKS A LOT for your help.

R.
 
Try this:

=SUM(INDIRECT(A1&":"&A2))

Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)
 
Back
Top