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

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?
 
G

Gord Dibben

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


Gord Dibben MS Excel MVP
 
J

J.W. Aldridge

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...
 
G

Gord Dibben

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
 
F

Fred Smith

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top