ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Changing function name in formula (https://www.excelbanter.com/excel-worksheet-functions/270866-changing-function-name-formula.html)

kittronald July 19th 11 11:45 PM

Changing function name in formula
 
I'm trying to create a formula that will allow changing the
function used.

For example:

A B
1 2 Product
2 3
3
4 =B1(A1:A2)

=B1(A1:A2) should evaluate to 6.

How can I get B1 to not be evaluated as text ?


- Ronald K.

Sixthsense July 20th 11 08:04 AM

Changing function name in formula
 
Hi Ronald,

Place the cursor in B1 cell and press Alt+E+A+F and copy and the paste
or type the below formula B1 cell

=Sum(A1:A2)

Or
=A1+A2

The above formula will evaluate the result as 5.

Hope that helps!

---

Sixthsense


On Jul 20, 3:45*am, kittronald wrote:
* *I'm trying to create a formula that will allow changing the
function used.

* *For example:

* * * * A * * * B
1 * * * 2 * * * Product
2 * * * 3
3
4 * * * =B1(A1:A2)

* *=B1(A1:A2) should evaluate to 6.

* *How can I get B1 to not be evaluated as text ?

- Ronald K.



David Biddulph July 20th 11 09:02 AM

Changing function name in formula
 
I think the OP wanted the product, not the sum.
=PRODUCT(A1:A2) or =A1*A2 will give the product.

David Biddulph


On 20/07/2011 08:04, Sixthsense wrote:
Hi Ronald,

Place the cursor in B1 cell and press Alt+E+A+F and copy and the paste
or type the below formula B1 cell

=Sum(A1:A2)

Or
=A1+A2

The above formula will evaluate the result as 5.

Hope that helps!

---

Sixthsense


On Jul 20, 3:45 am, wrote:
I'm trying to create a formula that will allow changing the
function used.

For example:

A B
1 2 Product
2 3
3
4 =B1(A1:A2)

=B1(A1:A2) should evaluate to 6.

How can I get B1 to not be evaluated as text ?

- Ronald K.




isabelle July 20th 11 12:35 PM

Changing function name in formula
 
hi,

=EvaluateString(B1&"(A1:A2)")

Function EvaluateString(tString As String)
EvaluateString = Evaluate(tString)
End Function

cell B1 can contain a function like
Product, Sum, Max, Min, etc..



--
isabelle


kittronald July 20th 11 11:01 PM

Changing function name in formula
 
Isabelle,

Thanks for the response and understanding what I was trying to
accomplish.

For calculating one cell, your solution works.

Is there a way to modify it so that I can Fill Down or Fill Right.

For example, if I were to fill right ...

=EvaluateString($B$1&"(A1:A2)")

it should look like ...

=EvaluateString($B$1&"(B1:B2)").


- Ronald K.

kittronald July 20th 11 11:49 PM

Changing function name in formula
 
Isabelle,

Figured it out.

=EvaluateString($B$1)(A1:A2)

You're The Man ... I mean you're The Woman.

Thanks for the help.


- Ronald K.

Gord July 21st 11 12:04 AM

Changing function name in formula
 
You have tested this thoroughly?


Gord Dibben Microsoft Excel MVP


On Wed, 20 Jul 2011 15:49:26 -0700 (PDT), kittronald
wrote:

Isabelle,

Figured it out.

=EvaluateString($B$1)(A1:A2)

You're The Man ... I mean you're The Woman.

Thanks for the help.


- Ronald K.


isabelle July 21st 11 01:23 AM

Changing function name in formula
 
wow, i can confirm that neni ;-)


--
isabelle


Le 2011-07-20 19:04, Gord a écrit :
You have tested this thoroughly?


isabelle July 21st 11 01:46 AM

Changing function name in formula
 
hi kittronald,

=EvaluateString($B$1&"(B1:B2)").


the cell "B1" can not be do "function name" and be a part of the evaluation


--
isabelle


kittronald July 21st 11 05:51 AM

Changing function name in formula
 
Isabelle,

<Sound of air leaving balloon

Ok, so I'm back to square one.

I was using a different, third party function, that when evaluated,
mysteriously returned a number - which led me to believe the correct
value was being returned.

Basically, I'm trying to mass replace a function without resorting
to using a macro that performs a Search and Replace.

If B1 were the linked cell of a ComboBox that had multiple function
names, how could I achieve the initial solution ?

And how did I earn the title of a Hungarian aunt ?



- Ronald K.


All times are GMT +1. The time now is 10:29 PM.

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