# If Statements

#### Sara R.

##### Board Regular
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)))

Sara

### Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
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!

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

Replies
3
Views
210
Replies
3
Views
243
Replies
17
Views
397
Replies
2
Views
126
Replies
1
Views
104

1,203,437
Messages
6,055,375
Members
444,781
Latest member
rishivar

### 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?

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