Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested IF statements using Excel 3

Status
Not open for further replies.

sgore

Programmer
Jul 22, 2001
30
CA
I am have trouble putting together a string of nested IF's using excel

Col 1 Values = ( 1, 2, 3)
Col 2 Values = (any number)
Col 3 Values = ( Y or N)

Here is what I need to accomplish:

IF COL1 = 1
IF COL2 > 20 ---> if true value equal N else value = Y
IF COL1 = 2
IF COL2 > 60 ---> if true value equal N else value = Y
IF COL1 = 3
IF COL2 > 60 ---> if true value equal N else value = Y

here is what I have:

=IF(C:C=1,IF(D:D>20,&quot;N&quot;,&quot;Y&quot;)) <-- This portion works

I have tried putting an OR and another IF at the end of this statement but only gets to the first IF.

=IF(C:C=1,IF(D:D>20,&quot;N&quot;,&quot;Y&quot;)+OR,IF(C:C=1,IF(D:D>60,&quot;N&quot;,&quot;Y))
doesn't work...

I am not real familuar with using Excel so any help would be most appreciated..

 
I'm not sure what you want to accomplish...

but try this.

=IF(C:C=1,IF(D:D>20,&quot;N&quot;,&quot;Y&quot;),IF(C:C=2,IF(D:D>60,&quot;N&quot;,&quot;Y&quot;),IF(C:C=3,IF(D:D>60,&quot;N&quot;,&quot;Y&quot;))))
 
Excel's IF function works like this:

=IF(Test,Result if TRUE,Result if FALSE)

Search Excel's help Index for IF and the IF_Worksheet_Function will show. There are some good examples in there.

Excel's OR function works like this:

=OR(logical1,logical2,...,logical30)

Search Excel's help Index for OR and the IF_Worksheet_Function will show. There are some good examples in there.

There is also an example of an OR nested in an IF

There is good help at:
and
Hope this helps.
 
danomaniac

That worked, I thought I tried that senerio... I must have left out the comma or something like that...

Anyways thank for your help..
 
danomaniac,

If your solution worked then you desewrve a &quot;A married man should forget all his mistakes. There is no point in two people remembering the same thing.&quot;
 
too quick to hit submit. I meant
star.gif
&quot;A married man should forget all his mistakes. There is no point in two people remembering the same thing.&quot;
 
sgore,

I created a &quot;special&quot; example file specifically for your situation - to demonstrate the significant power of Excel's &quot;database extraction&quot; option.

I chose to create this file for two reasons:

1) To demonstrate the power of the option as mentioned.

2) On the expectation that the example you gave is only a brief example of a much larger database - from which you want to &quot;selectivly&quot; isolate the records that meet your stated criteria.

By using Excel's database extraction option, the data you want to isolate can be extracted to a separate sheet or filtered-in-place. In many situations, users prefer to extract the data, often to generate reports with custom headings and formatting.

The example I've created for you does just that - extracts the data (based on your criteria) and prepares the extracted data for printing.

If you'd like a copy of the file, email me and I'll send you the file via return email.

Regards, ...Dale Watson dwatson@bsi.gov.mb.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top