#1   Report Post  
mkerstei
 
Posts: n/a
Default If statement help


I have a worksheet, and if cell 1 contains the word "Minimum," I need it
to compare cells 2 and 3. I need it to run the equation in cell 4
=if(cell3=cell2,"yes","no")
But if cell1 contains the word Maximum, I need it to compare cells 2
and 3 and run the equation:
=if(cell3<=cell2,"Yes","No")
I think you can use the =find statement, but I cannot get it to work.
Any suggestions?


--
mkerstei
------------------------------------------------------------------------
mkerstei's Profile: http://www.excelforum.com/member.php...o&userid=25688
View this thread: http://www.excelforum.com/showthread...hreadid=392939

  #2   Report Post  
swatsp0p
 
Posts: n/a
Default


I see two options...

1) the cell (e.g. A1) must contain either MINIMUM or MAXIMUM (no blanks
or other values) use this formula:

=IF(A1="MINIMUM",IF(C1=B1,"YES","NO"),IF(C1<=B1," YES","NO")) --or
this formula:
=IF(OR(AND(A1="MINIMUM",C1=B1),AND(A1="MAXIMUM",C 1<=B1)),"yes","no")

2) the cell (e.g. A1) may be blank or contain something other than Min.
or Max.

=IF(A1="MINIMUM",IF(C1=B1,"YES","NO"),IF(A1="MAXI MUM",IF(C1<=B1,"YES","NO"),"N/A"))
--or this formula:
=IF(OR(AND(A1="minimum",C1=B1),AND(A1="maximum",C 1<=B1)),"yes",IF(OR(A1="MINIMUM",A1="MAXIMUM"),"NO ","N/A"))

Is this what you were looking for?

Bruce


--
swatsp0p


------------------------------------------------------------------------
swatsp0p's Profile: http://www.excelforum.com/member.php...o&userid=15101
View this thread: http://www.excelforum.com/showthread...hreadid=392939

  #3   Report Post  
JE McGimpsey
 
Posts: n/a
Default

One way:


=IF(A1="Minimum",IF(A3=A2,"Yes","No"), IF(A1="Maximum",
IF(A3<=A2,"Yes","No"),""))

In article ,
mkerstei
wrote:

I have a worksheet, and if cell 1 contains the word "Minimum," I need it
to compare cells 2 and 3. I need it to run the equation in cell 4
=if(cell3=cell2,"yes","no")
But if cell1 contains the word Maximum, I need it to compare cells 2
and 3 and run the equation:
=if(cell3<=cell2,"Yes","No")
I think you can use the =find statement, but I cannot get it to work.
Any suggestions?

  #4   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

Enter this in Cell 4, replacing the Cell1, Cell2, and Cell3 with the addresses of the appropriate
cells:

=IF(NOT(ISERROR(FIND("minimum",LOWER(Cell1)))),IF( Cell3=Cell2,"yes","no"),IF(NOT(ISERROR(FIND("maxi mum",LOWER(Cell1)))),IF(Cell3<=Cell2,"yes","no")," Neither"))

HTH,
Bernie
MS Excel MVP


"mkerstei" wrote in message
...

I have a worksheet, and if cell 1 contains the word "Minimum," I need it
to compare cells 2 and 3. I need it to run the equation in cell 4
=if(cell3=cell2,"yes","no")
But if cell1 contains the word Maximum, I need it to compare cells 2
and 3 and run the equation:
=if(cell3<=cell2,"Yes","No")
I think you can use the =find statement, but I cannot get it to work.
Any suggestions?


--
mkerstei
------------------------------------------------------------------------
mkerstei's Profile: http://www.excelforum.com/member.php...o&userid=25688
View this thread: http://www.excelforum.com/showthread...hreadid=392939



  #5   Report Post  
swatsp0p
 
Posts: n/a
Default


One other option I just realized, is that the words MINIMUM or MAXIMUM
may be contained within other text (e.g. "Value is MINIMUM")....

=IF(NOT(ISERROR(FIND("MINIMUM",A1)0)),IF(C1=B1," YES","NO"),IF(NOT(ISERROR(FIND("MAXIMUM",A1)0)),I F(C1<=B1,"YES","NO"),"N/A"))

note that the FIND function IS case sensitive. MINIMUM, minimum and
Minimum are all different and, in my example, only MINIMUM will return
the desired answer. The others will return "N/A".

this can be overcome by using SEARCH instead of FIND, as such:

=IF(NOT(ISERROR(SEARCH("MINIMUM",A1)0)),IF(C1=B1 ,"YES","NO"),IF(NOT(ISERROR(SEARCH("MAXIMUM",A1)0 )),IF(C1<=B1,"YES","NO"),"N/A"))


HTH

Bruce


--
swatsp0p


------------------------------------------------------------------------
swatsp0p's Profile: http://www.excelforum.com/member.php...o&userid=15101
View this thread: http://www.excelforum.com/showthread...hreadid=392939



  #6   Report Post  
mkerstei
 
Posts: n/a
Default


Thank you! This solved my problem.


--
mkerstei
------------------------------------------------------------------------
mkerstei's Profile: http://www.excelforum.com/member.php...o&userid=25688
View this thread: http://www.excelforum.com/showthread...hreadid=392939

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Do I need a sumif or sum of a vlookup formula? PeterB Excel Worksheet Functions 0 June 1st 05 12:23 PM
How to calculate a sum as one outcome of an IF statement barb in NC Excel Worksheet Functions 2 March 31st 05 08:01 PM
What statement to use? Paul Excel Worksheet Functions 6 February 13th 05 05:23 PM
How do I fix a circular reference in a financial statement? drjayhawk25 Excel Discussion (Misc queries) 0 February 7th 05 05:19 PM
Statement lintan Excel Worksheet Functions 1 December 2nd 04 11:31 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"