If Statements

Sara R.

Board Regular
Joined
Jul 12, 2007
Messages
64
Is there any way I can join all of these IF statements together for one formula? I tried here, but this won't work.

=IF(AND($R2>=4/29/7,$R2<7/29/7),1,0),(IF(AND($R2>=7/29/7,$R2<10/28/7),2,0)),(IF(AND($R2>=10/28/7,$R2<1/27/8),3,0)),(IF(AND($R2>=1/27/8,$R2<4/27/8),4,0)))

Thanks in advance!!!

Sara
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Edited a few minutes later:
If you are trying to use dates, I have not been able to use the actual dates in my formulas. But, if one puts the dates in cells, and refers to them, then, all is well. As in: Say you put the date 04/12/07 in cell B3, then one can write, =IF(R2>=B3,1,0), and it will work!

To "join" these IF() functions, you cannot use a comma (,). You can concatenate using the ampersand (&) symbol, and you can add numbers using the (+) symbol. Below, I have concatenated your IF() functions:
=IF(AND($R2>=4/29/7,$R2<7/29/7),1,0)&(IF(AND($R2>=7/29/7,$R2<10/28/7),2,0))&(IF(AND($R2>=10/28/7,$R2<1/27/8),3,0))&(IF(AND($R2>=1/27/8,$R2<4/27/8),4,0)))

By the way, just what are the numbers, such as 4/29/7? They certainly are not dates!
 
Upvote 0
If what you are referring to are dates then try this


Code:
=IF(B10<DATE(2007,4,29),0,LOOKUP(B10,DATE(2007,1,28)+91*ROW(1:5),{1,2,3,4,5}))


confirm w/ ctrl + shift + Enter not just enter
 
Upvote 0

Forum statistics

Threads
1,215,026
Messages
6,122,738
Members
449,094
Latest member
dsharae57

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