Using variables as parameters of function

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.
 
R

Ron Coderre

Try this:

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

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

Regards,

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top