ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Temporary Storage in IF function (https://www.excelbanter.com/excel-worksheet-functions/139094-temporary-storage-if-function.html)

Chinni Krishna Reddy

Temporary Storage in IF function
 
I have a function like this..
=IF(expr 0 , expr , " ")

Now if my expr is again a big formula.. then is there any way of avoiding
repeating it as the second argument.. ie any temporary variable for storage
is available? like this...

=IF ((a=long_expr) 0 , a , "");

Pete_UK

Temporary Storage in IF function
 
If it is just one cell, then use a cell somewhere else to store the
value, eg put your expression in X1 then your formula can be:

=IF(X10,X1,"")

If you are doing this on a column of cells, then just copy the
expression down the X column (often referred to as a helper column),
then copy your formula down.

Hope this helps.

Pete

On Apr 16, 12:40 pm, Chinni Krishna Reddy <Chinni Krishna
wrote:
I have a function like this..
=IF(expr 0 , expr , " ")

Now if my expr is again a big formula.. then is there any way of avoiding
repeating it as the second argument.. ie any temporary variable for storage
is available? like this...

=IF ((a=long_expr) 0 , a , "");




Duke Carey

Temporary Storage in IF function
 
Unfortunately, you will have to have the formula stated twice, either within
the IF() function or somewhere else in the sheet.

However, if you are testing for an error, Excel 2007 has a new IfError()
function that allows you state your formula but once:

=iferror(long formula, value if formula errors)

If the formula works, IFERROR() gives the formula's results. If it errors,
IFERROR() returns the "value of formula errors"


"Chinni Krishna Reddy" wrote:

I have a function like this..
=IF(expr 0 , expr , " ")

Now if my expr is again a big formula.. then is there any way of avoiding
repeating it as the second argument.. ie any temporary variable for storage
is available? like this...

=IF ((a=long_expr) 0 , a , "");


JMB

Temporary Storage in IF function
 
You might also look at Laurent Longre's morefunc.xll add-in. The SETV and
GETV functions appear to be applicable to what you want to do.

http://xcell05.free.fr/

Or maybe you could just use
=MAX(expr, 0)
and use a custom number format like
0;-0;;
to suppress displaying the 0 if you do not want it displayed? The cell will
still have a value of 0 - so this may affect your dependent formulas.


"Chinni Krishna Reddy" wrote:

I have a function like this..
=IF(expr 0 , expr , " ")

Now if my expr is again a big formula.. then is there any way of avoiding
repeating it as the second argument.. ie any temporary variable for storage
is available? like this...

=IF ((a=long_expr) 0 , a , "");


RagDyeR

Temporary Storage in IF function
 
You might try using 2 cells.

Say A1 is
=expr

And, in the result cell:
=IF(A10,A1,"")
--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------

"Chinni Krishna Reddy" <Chinni Krishna
wrote in message ...
I have a function like this..
=IF(expr 0 , expr , " ")

Now if my expr is again a big formula.. then is there any way of avoiding
repeating it as the second argument.. ie any temporary variable for
storage
is available? like this...

=IF ((a=long_expr) 0 , a , "");





All times are GMT +1. The time now is 04:54 AM.

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