=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

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
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..
 
Upvote 0
I think you can nest only 7 IFs more than taht you may not be able to add. Check with Help

TIA
GNaga
 
Upvote 0

Forum statistics

Threads
1,214,784
Messages
6,121,535
Members
449,037
Latest member
tmmotairi

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