ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Variable in arguments (https://www.excelbanter.com/excel-worksheet-functions/166288-variable-arguments.html)

mario

Variable in arguments
 
Hi there,

I would like to know how to add variable to arguments. E.g.: If I want to
write the formula =min(A10:B25), but instead of writing fixed cells, I would
like somthing like =min(A10:B"X+20"), where I can set any value to X. In this
case, if I set X=10, I would like to know the minimun between A20 and B30
(that is 10 + 20).

Thanks.
Mario

carlo

Variable in arguments
 
On Nov 16, 9:01 am, Mario wrote:
Hi there,

I would like to know how to add variable to arguments. E.g.: If I want to
write the formula =min(A10:B25), but instead of writing fixed cells, I would
like somthing like =min(A10:B"X+20"), where I can set any value to X. In this
case, if I set X=10, I would like to know the minimun between A20 and B30
(that is 10 + 20).

Thanks.
Mario


What you need is the indirect function:

=min(indirect("A10:B" & X+ 20)

hth

Carlo

Don Guillett

Variable in arguments
 
If you wanted to put your value in cell e1
=MIN(INDIRECT("A10:B"&E1))
or
=MIN(INDIRECT("A10:B"&E1+20))
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mario" wrote in message
...
Hi there,

I would like to know how to add variable to arguments. E.g.: If I want to
write the formula =min(A10:B25), but instead of writing fixed cells, I
would
like somthing like =min(A10:B"X+20"), where I can set any value to X. In
this
case, if I set X=10, I would like to know the minimun between A20 and B30
(that is 10 + 20).

Thanks.
Mario



mario

Variable in arguments
 
Cool. This is what I wanted. Many thanks. :-)

"Don Guillett" wrote:

If you wanted to put your value in cell e1
=MIN(INDIRECT("A10:B"&E1))
or
=MIN(INDIRECT("A10:B"&E1+20))
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mario" wrote in message
...
Hi there,

I would like to know how to add variable to arguments. E.g.: If I want to
write the formula =min(A10:B25), but instead of writing fixed cells, I
would
like somthing like =min(A10:B"X+20"), where I can set any value to X. In
this
case, if I set X=10, I would like to know the minimun between A20 and B30
(that is 10 + 20).

Thanks.
Mario




Don Guillett

Variable in arguments
 
Glad to help

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mario" wrote in message
...
Cool. This is what I wanted. Many thanks. :-)

"Don Guillett" wrote:

If you wanted to put your value in cell e1
=MIN(INDIRECT("A10:B"&E1))
or
=MIN(INDIRECT("A10:B"&E1+20))
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mario" wrote in message
...
Hi there,

I would like to know how to add variable to arguments. E.g.: If I want
to
write the formula =min(A10:B25), but instead of writing fixed cells, I
would
like somthing like =min(A10:B"X+20"), where I can set any value to X.
In
this
case, if I set X=10, I would like to know the minimun between A20 and
B30
(that is 10 + 20).

Thanks.
Mario






All times are GMT +1. The time now is 02:51 AM.

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