ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   #Value! Error in Nested IF Function (https://www.excelbanter.com/new-users-excel/225517-value-error-nested-if-function.html)

tom

#Value! Error in Nested IF Function
 
I have to IF Functions that work independently and I am trying to combine
them into one function. My desired end result is either the text "BUY" or
"SELL".

1st Function - IF(AND($B$13="High",$I$13="S"),"SELL","")

If cell B13 has the text "High" and I13 has the text "S", then generate the
word "SELL". If this is false, then leave the cell blank.

2nd Function - IF(AND($C$9="Low",$I$9="L"),"BUY","")
If cell C13 has the text "low" and I13 has the text "L", then generate the
word "BUY". If this is false, then leave the cell blank.

Issue - Combine these 2 independently working functions.
Desired result when combined is either "BUY", "SELL", or blank.

What I tried:
OR(IF(AND($B$17="High",$I$17="S"),"SELL",""),IF(AN D($C$17="Low",$I17="L"),"BUY","")

Result a #VALUE! Error

This is really a circular reference error as I want the true result of these
2 nested IF functions to be displayed. I just do not know how to do it.

OR(IF(AND($B$17="High",$I$17="S"),"SELL",""),IF(AN D($C$17="Low",$I17="L"),"BUY",""), show the true result - "BUY", "SELL" or blank.

I hope this makes sense.
Any help is appreciated.

Regards,
Tom




Francis

#Value! Error in Nested IF Function
 
Hi
try this

=IF(AND(B13="High",I13="S"),"SELL",IF(AND(C13="Low ",I13="L"),"BUY",""))

--
Hope this is helpful

Pls click the Yes button below if this post provide answer you have asked

Thank You

cheers, francis

Am not a greek but an ordinary user trying to assist another



"Tom" wrote:

I have to IF Functions that work independently and I am trying to combine
them into one function. My desired end result is either the text "BUY" or
"SELL".

1st Function - IF(AND($B$13="High",$I$13="S"),"SELL","")

If cell B13 has the text "High" and I13 has the text "S", then generate the
word "SELL". If this is false, then leave the cell blank.

2nd Function - IF(AND($C$9="Low",$I$9="L"),"BUY","")
If cell C13 has the text "low" and I13 has the text "L", then generate the
word "BUY". If this is false, then leave the cell blank.

Issue - Combine these 2 independently working functions.
Desired result when combined is either "BUY", "SELL", or blank.

What I tried:
OR(IF(AND($B$17="High",$I$17="S"),"SELL",""),IF(AN D($C$17="Low",$I17="L"),"BUY","")

Result a #VALUE! Error

This is really a circular reference error as I want the true result of these
2 nested IF functions to be displayed. I just do not know how to do it.

OR(IF(AND($B$17="High",$I$17="S"),"SELL",""),IF(AN D($C$17="Low",$I17="L"),"BUY",""), show the true result - "BUY", "SELL" or blank.

I hope this makes sense.
Any help is appreciated.

Regards,
Tom




joeu2004

#Value! Error in Nested IF Function
 
"Tom" wrote:
What I tried:
OR(IF(AND($B$17="High",$I$17="S"),"SELL",""),IF(AN D($C$17="Low",$I17="L"),"BUY","")

Result a #VALUE! Error


Because you cannot OR() text values, which is the result of each IF() function.


1st Function - IF(AND($B$13="High",$I$13="S"),"SELL","")
If cell B13 has the text "High" and I13 has the text "S", then generate the
word "SELL". If this is false, then leave the cell blank.

2nd Function - IF(AND($C$9="Low",$I$9="L"),"BUY","")
If cell C13 has the text "low" and I13 has the text "L", then generate the
word "BUY". If this is false, then leave the cell blank.

Issue - Combine these 2 independently working functions.
Desired result when combined is either "BUY", "SELL", or blank.


But combine them how? Actually, don't focus on "combine" (syntax). Simply write in English under what conditions you want "BUY", "SELL" and blank. Your example is unclear.

Perhaps the following is close to what you want:

=IF(AND($B$13="High",$I$13="S"),"SELL",
IF(AND($C$9="Low",$I$9="L"),"BUY",""))

Now, however, that I have presumed a priority between the two conditions. A priori, the sell and buy conditions are not mutually exclusive. So the following might give different results:

=IF(AND($C$9="Low",$I$9="L"),"BUY",
IF(AND($B$13="High",$I$13="S"),"SELL",""))

Only you can decide which is better. Or perhaps that is not the right logic at all.


----- original message -----

"Tom" wrote in message ...
I have to IF Functions that work independently and I am trying to combine
them into one function. My desired end result is either the text "BUY" or
"SELL".

1st Function - IF(AND($B$13="High",$I$13="S"),"SELL","")

If cell B13 has the text "High" and I13 has the text "S", then generate the
word "SELL". If this is false, then leave the cell blank.

2nd Function - IF(AND($C$9="Low",$I$9="L"),"BUY","")
If cell C13 has the text "low" and I13 has the text "L", then generate the
word "BUY". If this is false, then leave the cell blank.

Issue - Combine these 2 independently working functions.
Desired result when combined is either "BUY", "SELL", or blank.

What I tried:
OR(IF(AND($B$17="High",$I$17="S"),"SELL",""),IF(AN D($C$17="Low",$I17="L"),"BUY","")

Result a #VALUE! Error

This is really a circular reference error as I want the true result of these
2 nested IF functions to be displayed. I just do not know how to do it.

OR(IF(AND($B$17="High",$I$17="S"),"SELL",""),IF(AN D($C$17="Low",$I17="L"),"BUY",""), show the true result - "BUY", "SELL" or blank.

I hope this makes sense.
Any help is appreciated.

Regards,
Tom


tom

#Value! Error in Nested IF Function
 
Joe:

THANK YOU!

The first formula works as I want are mutually execulsive.

However, I still do not understand why it worked. My guess is I am just not
writing out the order of execution processes.

My understanding of if functions a
=if(logical_test,value_if_true, value_if_false)

In your first example, you pulled this apart by

=IF(AND($B$13="High",$I$13="S"),"SELL",
then you created another IF statement for the false of:
IF(AND($C$9="Low",$I$9="L"),"BUY","")).

Thanks!

Tom



"JoeU2004" wrote:

"Tom" wrote:
What I tried:
OR(IF(AND($B$17="High",$I$17="S"),"SELL",""),IF(AN D($C$17="Low",$I17="L"),"BUY","")

Result a #VALUE! Error


Because you cannot OR() text values, which is the result of each IF() function.


1st Function - IF(AND($B$13="High",$I$13="S"),"SELL","")
If cell B13 has the text "High" and I13 has the text "S", then generate the
word "SELL". If this is false, then leave the cell blank.

2nd Function - IF(AND($C$9="Low",$I$9="L"),"BUY","")
If cell C13 has the text "low" and I13 has the text "L", then generate the
word "BUY". If this is false, then leave the cell blank.

Issue - Combine these 2 independently working functions.
Desired result when combined is either "BUY", "SELL", or blank.


But combine them how? Actually, don't focus on "combine" (syntax). Simply write in English under what conditions you want "BUY", "SELL" and blank. Your example is unclear.

Perhaps the following is close to what you want:

=IF(AND($B$13="High",$I$13="S"),"SELL",
IF(AND($C$9="Low",$I$9="L"),"BUY",""))

Now, however, that I have presumed a priority between the two conditions. A priori, the sell and buy conditions are not mutually exclusive. So the following might give different results:

=IF(AND($C$9="Low",$I$9="L"),"BUY",
IF(AND($B$13="High",$I$13="S"),"SELL",""))

Only you can decide which is better. Or perhaps that is not the right logic at all.


----- original message -----

"Tom" wrote in message ...
I have to IF Functions that work independently and I am trying to combine
them into one function. My desired end result is either the text "BUY" or
"SELL".

1st Function - IF(AND($B$13="High",$I$13="S"),"SELL","")

If cell B13 has the text "High" and I13 has the text "S", then generate the
word "SELL". If this is false, then leave the cell blank.

2nd Function - IF(AND($C$9="Low",$I$9="L"),"BUY","")
If cell C13 has the text "low" and I13 has the text "L", then generate the
word "BUY". If this is false, then leave the cell blank.

Issue - Combine these 2 independently working functions.
Desired result when combined is either "BUY", "SELL", or blank.

What I tried:
OR(IF(AND($B$17="High",$I$17="S"),"SELL",""),IF(AN D($C$17="Low",$I17="L"),"BUY","")

Result a #VALUE! Error

This is really a circular reference error as I want the true result of these
2 nested IF functions to be displayed. I just do not know how to do it.

OR(IF(AND($B$17="High",$I$17="S"),"SELL",""),IF(AN D($C$17="Low",$I17="L"),"BUY",""), show the true result - "BUY", "SELL" or blank.

I hope this makes sense.
Any help is appreciated.

Regards,
Tom



joeu2004

#Value! Error in Nested IF Function
 
"Tom" wrote:
However, I still do not understand why it worked.
[....]
My understanding of if functions a
=if(logical_test,value_if_true, value_if_false)


That's right. IF() is a function, not a "statement", in Excel. So the first "logical_test" and "value_if_true" is:

=IF(AND($B$13="High",$I$13="S"), "SELL"

The first "value_if_false" can be any expression. In your case, it happens to be an IF() function. So the form of the solution I provided is:

=if(logical_test1, value_if_true1, if(logical_test2, value_if_true2, value_if_false2))

If logical_test1 is TRUE, first IF() returns value_if_true1. If logical_test1 is FALSE, IF() returns value_if_false1 (not shown), which is an IF(). In evaluating value_if_false1, if logical_test2 is TRUE, the second IF() function returns value_if_true2; otherwise, it returns value_if_false2.

But it is important to understand that the use of IF() functions is not limited to this nested form. As I said, IF() is simply a function. You can use it wherever a value could be used.

For example, suppose you want the following: if B1<10, then B1*A1, otherwise B1*C1. That can be written two ways (among others):

=if(B1<10, B1*A1, B1*C1)

=B1 * if(B1<10, A1, C1)

HTH.


----- original message -----

"Tom" wrote:
Joe:

THANK YOU!

The first formula works as I want are mutually execulsive.

However, I still do not understand why it worked. My guess is I am just not
writing out the order of execution processes.

My understanding of if functions a
=if(logical_test,value_if_true, value_if_false)

In your first example, you pulled this apart by

=IF(AND($B$13="High",$I$13="S"),"SELL",
then you created another IF statement for the false of:
IF(AND($C$9="Low",$I$9="L"),"BUY","")).

Thanks!

Tom



"JoeU2004" wrote:

"Tom" wrote:
What I tried:
OR(IF(AND($B$17="High",$I$17="S"),"SELL",""),IF(AN D($C$17="Low",$I17="L"),"BUY","")

Result a #VALUE! Error


Because you cannot OR() text values, which is the result of each IF() function.


1st Function - IF(AND($B$13="High",$I$13="S"),"SELL","")
If cell B13 has the text "High" and I13 has the text "S", then generate the
word "SELL". If this is false, then leave the cell blank.

2nd Function - IF(AND($C$9="Low",$I$9="L"),"BUY","")
If cell C13 has the text "low" and I13 has the text "L", then generate the
word "BUY". If this is false, then leave the cell blank.

Issue - Combine these 2 independently working functions.
Desired result when combined is either "BUY", "SELL", or blank.


But combine them how? Actually, don't focus on "combine" (syntax). Simply write in English under what conditions you want "BUY", "SELL" and blank. Your example is unclear.

Perhaps the following is close to what you want:

=IF(AND($B$13="High",$I$13="S"),"SELL",
IF(AND($C$9="Low",$I$9="L"),"BUY",""))

Now, however, that I have presumed a priority between the two conditions. A priori, the sell and buy conditions are not mutually exclusive. So the following might give different results:

=IF(AND($C$9="Low",$I$9="L"),"BUY",
IF(AND($B$13="High",$I$13="S"),"SELL",""))

Only you can decide which is better. Or perhaps that is not the right logic at all.


----- original message -----

"Tom" wrote in message ...
I have to IF Functions that work independently and I am trying to combine
them into one function. My desired end result is either the text "BUY" or
"SELL".

1st Function - IF(AND($B$13="High",$I$13="S"),"SELL","")

If cell B13 has the text "High" and I13 has the text "S", then generate the
word "SELL". If this is false, then leave the cell blank.

2nd Function - IF(AND($C$9="Low",$I$9="L"),"BUY","")
If cell C13 has the text "low" and I13 has the text "L", then generate the
word "BUY". If this is false, then leave the cell blank.

Issue - Combine these 2 independently working functions.
Desired result when combined is either "BUY", "SELL", or blank.

What I tried:
OR(IF(AND($B$17="High",$I$17="S"),"SELL",""),IF(AN D($C$17="Low",$I17="L"),"BUY","")

Result a #VALUE! Error

This is really a circular reference error as I want the true result of these
2 nested IF functions to be displayed. I just do not know how to do it.

OR(IF(AND($B$17="High",$I$17="S"),"SELL",""),IF(AN D($C$17="Low",$I17="L"),"BUY",""), show the true result - "BUY", "SELL" or blank.

I hope this makes sense.
Any help is appreciated.

Regards,
Tom



RaMb0

Similar issue
 
I am also facing similar issue but due to blanks in my source cells.

https://docs.google.com/spreadsheets...g5A/edit#gid=0

I have shared the link of my document. Please see if you could help me out.


All times are GMT +1. The time now is 07:47 AM.

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