ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   IF Function Question (https://www.excelbanter.com/excel-discussion-misc-queries/446613-if-function-question.html)

koeio

IF Function Question
 
Hi

I Would like to know if it is possible to do something like this using IF:

From this:
=IF(A1*A2100;A1*A2;0)

To something like this:
=IF(A1*A2100;ResultFromTest;0)

Where "ResultFromTest" variable will be the result from the test "A1*A2", this way removing code redundancy.

Imagine how much a formula like this would be simplified:
From:
=IF(100-((A1*A2+(A3/A4))*A5/100)45;100-((A1*A2+(A3/A4))*A5/100);0)
To:
=IF(100-((A1*A2+(A3/A4))*A5/100)45;testResult;0)


Thanks

Claus Busch

IF Function Question
 
Hi,

Am Thu, 19 Jul 2012 16:30:21 +0000 schrieb koeio:

I Would like to know if it is possible to do something like this using
IF:

From this:
=IF(A1*A2100;A1*A2;0)

To something like this:
=IF(A1*A2100;ResultFromTest;0)

Where "ResultFromTest" variable will be the result from the test
"A1*A2", this way removing code redundancy.


e.g. enter =A1*A2 in G1, select Name manager and give G1 the name
ResultFromTest. Then you can use the name in the formula. But you don't
have to do it with an If-Statement. Try:
=(A1*A2100)*ResultFromTest
or
=(ResultFromTest100)*ResultFromTest


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2

koeio

Thanks for your response

Your solution is not exactly what I want because you need to use other cells to implement.

Imagine you want to use tables with formulas like this:

Code:

Formula        X        Y
40        5        8
0        2        3
63        7        9
0        1        8
80        8        10

Where the cell Formula has this: "=IF([X]*[Y]30;[X]*[Y];0)"

Is there anyway to do this "=IF([X]*[Y]30;ResultFromTheLogicalTest;0)" without creating another column only for the "[X]*[Y]" calculation or use other cells?

Maybe some hidden IF parameter that does this: "=IF([X]*[Y]30;@result;0)" or other kind of function that I don't know.

Thanks


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

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