# Calculate Date with IF statement

Here is the ask: I need a formula for SP that will calculate the 1st of the next month or 1st of the second depending on the number in column titled week number.

``````class end Date    week number     30 Day
1/1/2017               1           2/1/17
1/28/17                4          3/1/17
``````

I was trying this formula but i get syntax error:

``````IF([Week Number]>=4,DATE((YEAR([Class End Date]),MONTH([Class End Date])+2,0)+1), (DATE(YEAR([Class End Date]),MONTH([Class End Date])+1,0)+1)
``````
• that is supposed to be 1/1/2017 with a week number of 1 and the calculated date is 2/1/17 ; then 1/28/17 with a week number of 4 and the calculated date is 3/1/17. – Randy K Jan 25 '17 at 21:48
• The first thing I notice is that you're missing a parenthesis at the end to close out the IF statement. – Erin L Jan 25 '17 at 23:05

You have missing parentheses, extra parenthesis, and `+1`s that don't make any sense.
`=IF([Week Number]>=4,DATE(YEAR([Class End Date]),MONTH([Class End Date])+2,1),DATE(YEAR([Class End Date]),MONTH([Class End Date])+1,1))`