Dealing with Negative Numbers in Nested If

JohnMarcus

New Member
Joined
Jan 3, 2013
Messages
3
Hello! I really need help on this problem. I don't know how to manipulate the formula with quoting the "You can't have cups less than zero". I really need help on this, please....please... I hope somebody can help me. thank you. God bless.


Teletubbies coffee - Nested If

Create a nested If function to describe the Teletubbies coffee drinking habits based on the following criteria:



  • 0 cups = Tea drinker

  • 1-5 cups = Normal

  • More than 5 cups = Caffeine fiend
Copy the function down and check that it works.


i4824.gif

Think carefully about how to structure the If function



Try modifying the If function so that if Cups of coffee is a negative number you see an appropriate error message.
i4825.gif
Make sure the rest of the function still works!
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
=IF(NoOfCupsOfCoffee<0,"You Can't Have Less than Zero Cups!",If(AND(NoOfCupsOfCoffee>=0,NoOfCupsOfCoffee<3),"Tea Drinker",If(AND(NoOfCupsOfCoffee>=3,NoOfCupsOfCoffee<6),"Normal",If(NoOfCupsOfCoffee>=6,"Caffiene Fiend")

Just replace NoOfCupsOfCoffee with your cell reference for the number of cups
 
Last edited:
Upvote 0
The word "You can't have less than 0 cups" should not be quoted. The formula should be manipulated to get that error message. By the way, thanks for your answer!
 
Upvote 0
Not very clear... Looks like some kind of assignment. I'd try:

Either...
Rich (BB code):
=LOOKUP(B2,{-9.99E+307,0,1,6},
    {"You can't have less than 0 cups!","Tea drinker","Normal","Caffeine Fiend"})
Or...
Rich (BB code):
=IF(ISNUMBER(B2),
   IF(B2>=0,
     LOOKUP(B2,{0,1,6},{"Tea drinker","Normal","Caffeine Fiend"}),
     "You can't have less than 0 cups!"),
   "")

By the way, what is the nested if formula you seem to have?
 
Last edited:
Upvote 0
Thank you for the effort and time. But the formula should not contain a quoted "You can't have less than 0 cups". The formula should be modify to get an error which is You can't have less than 0 cups. By the way my formula is =IF(B3<1,"Tea Drinker",IF(B3<5,"Normal","Caffeine fiend")). Please just make some modifications on it. thank you. I will wait for your reply. :)
 
Upvote 0
[...] the formula should not contain a quoted "You can't have less than 0 cups". The formula should be modify to get an error which is You can't have less than 0 cups.[...]

The exhibit you posted displays the message as such, so it's hard to make sense of the above other than what has been already proposed....
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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