SOLVED

if statement working with dates

Brass Contributor

I am trying to write an if statement where I have one sheet 2019 and the next sheet 2020 but I keep getting a value error. the following is the formula that I am using: =IF(TEXT(DATE(INT((Dec!H1-1)/12)+2019,MOD(Dec!H1-1,12)+1,1),"mmm yyyy"),DATE(INT((Jan!H1-1)/12)+2019,MOD(Jan!H1-1,12)+1,1),"NO__"). thank you

8 Replies

@wjallen14 

Yes, formula is not correct, it looks like

=IF("some text", some date, "NO")

Condition shall return Boolean value.

 

Could you please clarify what is in H1 and what you'd like to receive.

@ wjalle14:

I believe the problem is in the first part of the IF statement.  There is nothing for the formula to evaluate as "true" or "False" - which is the basis for IF statement.  The portion immediately following If( is:

TEXT(DATE(INT((…….)+1,1),"mmm yyyy")

this portion is simply converting the contents of one of the cells into a text form in the format "mmm yyyy".  What is the IF statement evaluating to get to a "True" or "False" decision?  This is portion of your formula creating the #value error.  Add a decision type statement, your problem would be solved.

@Sergei Baklan  12/1/2019 is Dec HI

@Ajay K. SinghI will try that see what happens thank you

best response confirmed by wjallen14 (Brass Contributor)
Solution

@wjallen14 

If in H1 of Dec sheet you have 01 Dec, 2019 and in H1 of Jan sheet you'd like to have 01 Jan 2010 that could be like

=EDATE(Dec!H1,1)

Similar for other sheets.

 

@Sergei Baklan  I will try and see what happens thank you

works exactly what we wanted  thank you  @Sergei Baklan 

@wjallen14 , you are welcome

1 best response

Accepted Solutions
best response confirmed by wjallen14 (Brass Contributor)
Solution

@wjallen14 

If in H1 of Dec sheet you have 01 Dec, 2019 and in H1 of Jan sheet you'd like to have 01 Jan 2010 that could be like

=EDATE(Dec!H1,1)

Similar for other sheets.

 

View solution in original post