close

Depending on the contents of two cells, I would like to include in a formula
a different variable name (already defined). The problem is, I would like to
concatenate a given text together with the contents of those 2 cells to form
the name of a specific variable. I have looked for a function which could do
the trick (I mean, converting a string to a variable name), but apparently
there is not one.

Example: =Sum(quot;Variablequot;amp;Q1amp;Q2)

If Q1 = quot;Aquot; and Q2 = quot;5quot;, the formula should hipothetically return the sum
of the cells referred by the variable named VariableA5. Unfortunately, it
shows a VALUE error.

Thanks in advance

=INDIRECT(CONCATENATE(Q1,Q2))

Would return the contents of A5 in your example.

Hope this helps!

quot;Pauloquot; wrote:

gt; Depending on the contents of two cells, I would like to include in a formula
gt; a different variable name (already defined). The problem is, I would like to
gt; concatenate a given text together with the contents of those 2 cells to form
gt; the name of a specific variable. I have looked for a function which could do
gt; the trick (I mean, converting a string to a variable name), but apparently
gt; there is not one.
gt;
gt; Example: =Sum(quot;Variablequot;amp;Q1amp;Q2)
gt;
gt; If Q1 = quot;Aquot; and Q2 = quot;5quot;, the formula should hipothetically return the sum
gt; of the cells referred by the variable named VariableA5. Unfortunately, it
gt; shows a VALUE error.
gt;
gt; Thanks in advance

Hello
Use INDIRECT to build the variable range reference:
=Sum(INDIRECT(quot;Variablequot;amp;Q1amp;Q2,TRUE))

HTH
Cordially
Pascal

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()