date formula - need result to show as date - not number.

  • Thread starter Thread starter J.W. Aldridge
  • Start date Start date
J

J.W. Aldridge

b2 contains a date.
c2 contains a number.

If c2 is less than 6, then i want the previous date reflected.

=IF(C2<6,B2-1,B2)

Need to re-write this. (results aren't all reading as dates)

Any suggestions?
 
Simply format the formula cell as date with your choice of format.


Gord Dibben MS Excel MVP
 
Thanx...

but found the solution.

=IF(C2<6,B2-1,B2+0)

Had to add a number to the latter formula as well in order to make all
the results the same.
Simply changing the format didn't work as it was resulting in a whole
number, in the date format.

thanx again anyways...
 
Today's date in B2...........3/30/2020

4 in C2

=IF(C2<6,B2-1,B2) returns 40266 which is 3/29/2010 when formatted.


Gord
 
If that's the fix you had to apply, it means your dates are text. By forcing
Excel to do arithmetic on them, it will convert text to date, if it can, but
only for that formula. Making sure all your dates are true Excel dates, not
text, will generally make your life a lot easier.

Regards,
Fred
 
Back
Top