=if(and( Errors

jhorness

New Member
Joined
Sep 13, 2007
Messages
25
This is the formula I have so far...

=ROUND(IF(B4="",0,IF(AND(F4>=22,F4<49),1,IF(AND(F4>=49,F4<77),2,IF(AND(F4>=77,F4<105),3,IF(AND(F4>=105,F4<133),4,IF(AND(F4>=133,F4<161),5,F4/28)))))),0)

The formula I have above works fine, except when I try to add another =if(and( statement, I get an error message because I think I have too many And statements. I need to add 7 more statement for the remainder of the months in a year, 6 - 12.

Any idea on how I can fix this? Thanks
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
A common method to replace this structure...
IF(AND(F4>=22,F4<49),1,IF(AND(F4>=49,F4<77),2,IF(AND(F4>=77,F4<105),3,IF(AND(F4>=105,F4<133),4,IF(AND(F4>=133,F4<161),5

is
LOOKUP(F4,{0,22,49,77,105,133,161},{0,1,2,3,4,5,0})

assuming numbers Less than 22 or Greater than 160 should return a 0

Hope that helps..
 

gnaga

Well-known Member
Joined
Jul 9, 2002
Messages
723
Office Version
  1. 365
  2. 2016
  3. 2013
Platform
  1. Windows
I think you can nest only 7 IFs more than taht you may not be able to add. Check with Help

TIA
GNaga
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,037
Messages
5,856,960
Members
431,841
Latest member
jaybeem

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
Top