A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

If/And function help



 
 
Thread Tools Display Modes
  #1  
Old January 30th, 2004, 05:40 AM
Milehigh
external usenet poster
 
Posts: n/a
Default If/And function help

Hi,

I am trying to compare two different cells - where one
cell displays - CR, PR, SD, PD and the other cell
displays CR, SD, PD.

What I need to do is have the 3rd cell - where I want to
display a result based on the combination of the 2
previous cells:

If Cell 1 or Cell 2 = PD then Cell 3 = PD
If Cell 1 = SD and Cell 2 does not equal PD then Cell 3 =
SD
If Cell 1 = PR and Cell 2 does not equal PD then Cell 3 =
PR
If Cell 1 = CR and Cell 2 = SD then Cell 3 = PR
If Cell 1 = CR and Cell 2 = CR then Cell 3 = CR

I have tried the following formula in Cell 3 (with Cell 1
being d21 and Cell 2 = d22):

=if (d21="pd","pd",if (d22="pd","pd")),and(d21="SD",
d22"PD", "SD"),and(d21="PR",d22"PD", "PR"),and
(d21="CR",d22="SD", "PR"), and(d21="CR", d22="CR", "CR")

Any help would be greatly appreciated. I think I am on
the right track but not sure. Thanks in advance.
  #2  
Old January 30th, 2004, 05:57 AM
beeawwb
external usenet poster
 
Posts: n/a
Default If/And function help

Without any pretext...

=IF((OR(A1="PD",B1="PD")),"PD",(IF(AND(A1="SD",B1 "PD"),"SD",IF(AND(A1="PR",B1"PD"),"PR",(IF(AND( A1="CR",B1="SD"),"PR",IF(AND(A1="CR",B1="CR"),"CR" ,"")))))))

Hope that helps. It seems to work when I did it.

*wipes forehead*

-Bob


---
Message posted from http://www.ExcelForum.com/

  #3  
Old January 30th, 2004, 06:11 AM
external usenet poster
 
Posts: n/a
Default If/And function help

That's it! Thanks for your help - I have been pulling my
hairout trying to figure it out for the last hour!
Thanks again.....
-----Original Message-----
Without any pretext...

=IF((OR(A1="PD",B1="PD")),"PD",(IF(AND

(A1="SD",B1"PD"),"SD",IF(AND(A1="PR",B1"PD")," PR",(IF
(AND(A1="CR",B1="SD"),"PR",IF(AND
(A1="CR",B1="CR"),"CR","")))))))

Hope that helps. It seems to work when I did it.

*wipes forehead*

-Bob


---
Message posted from http://www.ExcelForum.com/

.

  #4  
Old January 30th, 2004, 11:38 AM
Bob Phillips
external usenet poster
 
Posts: n/a
Default If/And function help

Slightly simplified to

=IF((OR(D21="PD",D22="PD")),"PD",(IF(AND(D21="SD", D22"PD"),"SD",IF(OR(AND(
D21="PR",D22"PD"),AND(D21="CR",D22="SD")),"PR",I F(AND(D21="CR",D22="CR"),"
CR","")))))

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"beeawwb " wrote in message
...
Find Replace is my friend. *duhr*


=IF((OR(D21="PD",D22="PD")),"PD",(IF(AND(D21="SD", D22"PD"),"SD",IF(AND(D21
="PR",D22"PD"),"PR",(IF(AND(D21="CR",D22="SD")," PR",IF(AND(D21="CR",D22="C
R"),"CR","")))))))


---
Message posted from http://www.ExcelForum.com/



  #5  
Old January 30th, 2004, 03:20 PM
Harlan Grove
external usenet poster
 
Posts: n/a
Default If/And function help

"Bob Phillips" wrote...
Slightly simplified to

=IF((OR(D21="PD",D22="PD")),"PD",(IF(AND(D21="SD" ,D22"PD"),"SD",IF(OR(AND

(
D21="PR",D22"PD"),AND(D21="CR",D22="SD")),"PR", IF(AND(D21="CR",D22="CR"),

"
CR","")))))

....

It could be simplified further.

=IF(D22="PD","PD",IF(OR(D21={"PD","SD","PR"}),D21,
IF(AND(D21="CR",D22="SD"),"PR",IF(AND(D21="CR",D22 ="CR"),"CR",""))))


  #6  
Old January 30th, 2004, 04:15 PM
Bob Phillips
external usenet poster
 
Posts: n/a
Default If/And function help

I knew you wouldn't be able to resist vbg

Bob

"Harlan Grove" wrote in message
...

It could be simplified further.

=IF(D22="PD","PD",IF(OR(D21={"PD","SD","PR"}),D21,
IF(AND(D21="CR",D22="SD"),"PR",IF(AND(D21="CR",D22 ="CR"),"CR",""))))




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:00 PM.


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