![]() |
Variable Names in Formulas
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("Variable"&Q1&Q2) If Q1 = "A" and Q2 = "5", 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 |
Variable Names in Formulas
=INDIRECT(CONCATENATE(Q1,Q2))
Would return the contents of A5 in your example. Hope this helps! "Paulo" wrote: 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("Variable"&Q1&Q2) If Q1 = "A" and Q2 = "5", 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 |
Variable Names in Formulas
Hello
Use INDIRECT to build the variable range reference: =Sum(INDIRECT("Variable"&Q1&Q2,TRUE)) HTH Cordially Pascal |
All times are GMT +1. The time now is 06:20 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com