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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

RalphA

Well-known Member
Joined
May 14, 2003
Messages
3,829
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!
 

facethegod

Well-known Member
Joined
Aug 1, 2006
Messages
767
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
 

Watch MrExcel Video

Forum statistics

Threads
1,129,804
Messages
5,638,455
Members
417,025
Latest member
MusterDuster

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