Using the Date Function within the IF Function

Copper Contributor

Hello! I am attempting to make a monthly template which can be used for the next several years to track some data. My goal is to make this template in a fashion to self-update if a few key components are keyed in.

 

 

=IF(('Date Calculations'!$G$11)=3,"=DATE(O2,'Date Calculations'!G11,31")

 

This is the current function I am at which obviously displays "Date(O2,'Date Calculations'!G11,31" if the IF statement is true. I want it to display the Date Function's calculation if the IF statement is true.Date Problem.PNG

 

I am using this function for the End Date of the Month so that I can change it with correspondence to the month which is being keyed in (since months have different amounts of days). If you look to the right of the picture I uploaded you can see yellow boxes to which is where someone would key in the information and the Table's Dates would automatically update. Is there a way to have the End Date of the last week of the month be updated to match the last day of whichever month is being used?

 

Essentially I think the overarching question is: Is it possible to use a function such as DATE as the conclusion to a true IF statement?

1 Reply

Hi Benjamin,

 

Sorry, but I didn't catch how it works, with sample file could be easier. Your formula like

=IF(A1=3,"=Date(2019,A1,31)")

returns text "=Date(2019,A1,31)" if number 3 is in A1, otherwise FALSE. 

If you'd like to return the date that could be

=IF(A1=3,DATE(2019,A1,31))

or even better 

=IF(A1=3,EOMONTH(DATE(2019,A1,1),0))

 not to depend on number of days in the month