IF functions

karlitob

New Member
Joined
Jun 24, 2017
Messages
38
Hi all,

Would greatly appreciate some guidance on the below IF statements. I do not have an error values but the values that it generates is incorrect.

Column A:
Category 1
Category 2
Category 3
No Data Entered (I wanted to put this in for a blank....but perhaps I should just leave it blank)

Column B: (Based on Days(end_date,start_date)
n=<0 (i.e. negative numbers - the end date is after the start date - this is incorrectly entered at source. I have no ability to enter a force function to this system)
n=0 (i.e. zero - the start date and end date are the same)
n>0( i.e. positive Numbers - the end data was after the start date)


So I want to know if
- Category 1's were reported within 1 day
- Category 1's were reported but outside of the 1 day
- Category 1's were reported but no date was put in so I don't know if it was within / outside time.
- And for everything else NA.


Thanks all. Appreciate your help.

P.S. As I type this out, I wonder if there is anything confusing in the 'No Data Entered' - though I am explicit about which column I am speaking about.


=IF(AND(A2="Category 1",B2>-1,B2<2),"Yes",
IF(AND(A2="Category 1",B2>1),"No",
IF(AND(A2="Category 1",B2="No Data Entered"),"No Data Entered",
IF(AND(A2="Category 2",B2<0),"NA",
IF(AND(A2="Category 2",B2="No Data Entered"),"NA",
"NA")))))
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Re: (IF) Help Please

You can give an example with the real data and the expected result for each example.
 
Upvote 0
Re: (IF) Help Please

You can give an example with the real data and the expected result for each example.
Thanks for your help. Please see below.



Column A:
Category 1
Category 2
Category 3
No Data Entered

Column B:
Integer that ranges from -300 to +600 (But could be any number)
No Data Entered (No value returns No Data Entered)



=IF(AND(A2="Category 1",B2>-1,B2<2),"Yes",
IF(AND(A2="Category 1",B2>1),"No",
IF(AND(A2="Category 1",B2="No Data Entered"),"No Data Entered",
IF(AND(A2="Category 2",B2<0),"NA",
IF(AND(A2="Category 2",B2="No Data Entered"),"NA",
"NA")))))


Result:

Yes (A:Category 1 and (B:0 or B:1)
No (A: Category 1 and B:>1)
No Data Entered (A:Category 1 and B: No Data Entered)
NA (Everything else)q
 
Upvote 0
Re: (IF) Help Please

Try

<b>Sheet</b><br /><br /><table border="1" cellspacing="0" style="font-family:Calibri,Arial; font-size:11pt; background-color:#ffffff; "> <colgroup><col style="font-weight:bold; width:30px; " /><col style="width:80px;" /><col style="width:80px;" /><col style="width:80px;" /></colgroup><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td > </td><td >A</td><td >B</td><td >C</td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >1</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">CATEGORY</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">VALUE</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">RESULT</td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >2</td><td >Category 1</td><td style="text-align:right; ">0</td><td >Yes</td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >3</td><td >Category 1</td><td style="text-align:right; ">1</td><td >Yes</td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >4</td><td >Category 1</td><td style="text-align:right; ">2</td><td >No</td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >5</td><td >Category 1</td><td style="text-align:right; ">-1</td><td >NA</td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >6</td><td >Category 2</td><td style="text-align:right; ">1</td><td >NA</td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >7</td><td >Category 3</td><td style="text-align:right; ">2</td><td >NA</td></tr></table><br /><table style="font-family:Arial; font-size:10pt; border-style: groove ;border-color:#00ff00;background-color:#fffcf9; color:#000000; "><tr><td ><b></b></td></tr><tr><td ><table border = "1" cellspacing="0" cellpadding="2" style="font-family:Arial; font-size:9pt;"><tr style="background-color:#cacaca; font-size:10pt;"><td >Cell</td><td >Formula</td></tr><tr><td >C2</td><td >=IF(A2="Category 1",IF(OR(B2=0,B2=1),"Yes",IF(B2>1,"No","NA")),"NA")</td></tr></table></td></tr></table> <br /><br />
 
Upvote 0
Re: (IF) Help Please

Thank you.

I can see what you're doing there. It's not quite working as both column A and Column B has another value "No Data Entered". If Column A has 'Category 1" and Column B has 'No Data Entered' - I want the result to be "No Data Entered"

Thank you so much for your help.
 
Upvote 0
Re: (IF) Help Please

Sorry, I missed that last detail, here goes

<b></b><br /><br /><table border="1" cellspacing="0" style="font-family:Calibri,Arial; font-size:11pt; background-color:#ffffff; "> <colgroup><col style="font-weight:bold; width:30px; " /><col style="width:80px;" /><col style="width:108px;" /><col style="width:108px;" /></colgroup><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td > </td><td >A</td><td >B</td><td >C</td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >1</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">CATEGORY</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">VALUE</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">RESULT</td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >2</td><td >Category 1</td><td style="text-align:right; ">0</td><td >Yes</td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >3</td><td >Category 1</td><td style="text-align:right; ">1</td><td >Yes</td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >4</td><td >Category 1</td><td style="text-align:right; ">2</td><td >No</td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >5</td><td >Category 1</td><td style="text-align:right; ">-1</td><td >NA</td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >6</td><td >Category 2</td><td style="text-align:right; ">1</td><td >NA</td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >7</td><td >Category 3</td><td style="text-align:right; ">2</td><td >NA</td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >8</td><td >Category 1</td><td >No Data Entered</td><td >No Data Entered</td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >9</td><td >Category 2</td><td >No Data Entered</td><td >NA</td></tr></table><br /><table style="font-family:Arial; font-size:10pt; border-style: groove ;border-color:#00ff00;background-color:#fffcf9; color:#000000; "><tr><td ><b> </b></td></tr><tr><td ><table border = "1" cellspacing="0" cellpadding="2" style="font-family:Arial; font-size:9pt;"><tr style="background-color:#cacaca; font-size:10pt;"><td ></td><td >Formula</td></tr><tr><td >C2</td><td >=IF(A2="Category 1",IF(OR(B2=0,B2=1),"Yes",IF(B2="No Data Entered","No Data Entered",IF(B2>1,"No","NA"))),"NA")</td></tr></table></td></tr></table> <br /><br />
 
Upvote 0

Forum statistics

Threads
1,217,428
Messages
6,136,573
Members
450,021
Latest member
Jlopez0320

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top