ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calling operators in formulas (https://www.excelbanter.com/excel-programming/453702-calling-operators-formulas.html)

Matthew Dyer

Calling operators in formulas
 
Posting here since this group is much more active than the regular excel board.

Is it possible to call the 'operator' value of a cell as opposed to the 'text' value?

Example- A1 contains ''
A2 contains 2
A3 contains 1
I want to test =A2A3
Using the formula =A2&A1&A3 gives '21 instead of True. Is there some other way to do this?

Claus Busch

Calling operators in formulas
 
Hi,

Am Fri, 21 Jul 2017 21:41:46 -0700 (PDT) schrieb Matthew Dyer:

Example- A1 contains ''
A2 contains 2
A3 contains 1
I want to test =A2A3
Using the formula =A2&A1&A3 gives '21 instead of True. Is there some other way to do this?


in B1 write:
=A2&A1&A3
Then select C1 and define the name "Result" refers to:
=EVALUATE(Sheet1!$B$1)
Now write in C1:
=Result


Regards
Claus B.
--
Windows10
Office 2016

Matthew Dyer

Calling operators in formulas
 
So I can define a name that encapsulates the 'formula' I want to evaluate, then use the evaluate formula to do the evaluation, but I cannot directly use 'greater than' instead of the text ''. I like the workaround

Peter T[_7_]

Calling operators in formulas
 

"Matthew Dyer" wrote in message

So I can define a name that encapsulates the 'formula' I want to evaluate,
then use the evaluate formula to do the evaluation, but I cannot directly
use 'greater than' instead of the text ''. I like the workaround


Yes EVALUATE is also Macro4 function which you can use in a named formula,
eg

=EVALUATE(Sheet1!$A$2&Sheet1!$A$1&Sheet1!$A$3)

Note where the cursor is when defining, depending on usage you may or may
not want the $'s in the named formula.

If all you want to do is cater for the 4 comparison operators

=IF(A1="",A2A3,IF(A1="=",A2=A3,IF(A1="<",A2<A3 ,IF(A1="<=",A2<=A3))))

With an additional IF could include "="

Easily adapted for 'greater than'

Could also be defined as a named formula

Peter T





Peter T[_7_]

Calling operators in formulas
 

"Peter T" wrote in message

Yes EVALUATE is also Macro4 function which you can use in a named formula,


Sorry, I misread Claus had already used Evalueate as a named formula

PT




All times are GMT +1. The time now is 12:40 PM.

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