Combining 2 Formulas

G

Guest

I have these 2 formulas:


Formula1=IF(OR(AND(K5<2;F5<=-0.25);AND(K5>=2;K5<=5;F5<=-0.4);AND(K5>5;K5<=10;F5<=-0.5);AND(K5>10;K5<=20;F5<=-0.8);AND(K5>20;F5<=-1));"Check";"")

Formula2=IF(H5="sell";K5-M5;N5-K5)

Formula2 is used in Formula1 where F5 is referenced. Is it possible to place
formula 2 into formula1 directly so I do not need an additional cell
refernced ?

Thank you in advance.
 
B

Bob Phillips

You should be able to just whack it in

=IF(OR(AND(K5<2,IF(H5="sell",K5-M5,N5-K5)<=-0.25),AND(K5>=2,K5<=5,IF(H5="sel
l",K5-M5,N5-K5)<=-0.4),

AND(K5>5,K5<=10,IF(H5="sell",K5-M5,N5-K5)<=-0.5),AND(K5>10,K5<=20,IF(H5="sel
l",K5-M5,N5-K5)<=-0.8),AND(K5>20,IF(H5="sell",K5-M5,N5-K5)<=-1)),
"Check","")

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)
 
B

Bernard Liengme

That would make the formula unreadable!

An alternative suggestion :
use Insert Name and create a name MYTEST with this formula
=(Sheet1!$H$5="sell")*(Sheet1!$K$5-Sheet1!$M$5)+(Sheet1!$H$5<>"sell")*(Sheet1!$N$5-Sheet1!$K$5)
Omit the Sheet1 stuff when you type it in - copy and paste this:
=($H$5="sell")*($K$5-$M$5)+($H$5<>"sell")*($N$5-$K$5)

Now modify your Formula1 to read
Formula1=IF(OR(AND(K5<2;MYTEST<=-0.25);AND(K5>=2;MYTEST<=5;MYTEST<=-0.4);AND(K5>5;K5<=10;MYTEST<=-0.5);AND(K5>10;K5<=20;MYTEST<=-0.8);AND(K5>20;MYTEST<=-1));"Check";"")

I had to make up an addition formula in Insert | Name since you cannot use
IF in a defined formula.
best wishes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top