ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How to pass variables as arguments of a function (https://www.excelbanter.com/excel-worksheet-functions/239525-how-pass-variables-arguments-function.html)

Excel-craze

How to pass variables as arguments of a function
 
How to pass variables as arguments to a function call? For example, I want
to sum(Sheet1!E31:E38) where €œSheet1€ is a variable while €œE31:E38€ is
another string variable to be concatenated with €œSheet1€. I tried assigning
€œSheet1€ to cell A1, €œE31€ to cell A2, €œE38€ to cell C1 and use the function
=sum(concatenate(A1,€!€,B1,€€:€,C1)) but it did not work.

Jacob Skaria

How to pass variables as arguments of a function
 
Try using INDIRECT() function

=SUM(INDIRECT("'" & A1 & "'!" & A2 & ":" & C1))

If this post helps click Yes
---------------
Jacob Skaria


"Excel-craze" wrote:

How to pass variables as arguments to a function call? For example, I want
to sum(Sheet1!E31:E38) where €œSheet1€ is a variable while €œE31:E38€ is
another string variable to be concatenated with €œSheet1€. I tried assigning
€œSheet1€ to cell A1, €œE31€ to cell A2, €œE38€ to cell C1 and use the function
=sum(concatenate(A1,€!€,B1,€€:€,C1)) but it did not work.



All times are GMT +1. The time now is 12:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com