"IF" with date formatting

u15986

New Member
Joined
May 1, 2013
Messages
4
How do I obtain this desired result: If M5 contains a date, P5 displays 0;
if M5 is empty, P5 displays the number of days passed in the current month
(ex. if M5 is empty and N2 displays 3-May-13 then P5 displays 3)
N2 displays today's date
M5 may or may not display an end date

Thank you,
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
=if(isblank(M5),day(today()),0)

or

=if(isblank(M5),day(N2),0)

This assumes M5 can only contain a date, or be blank.

If it is possible that M5 may contain something else, such as a text string, or a numeric value that is not a date, then you will need something more complex.
 
Upvote 0

Forum statistics

Threads
1,215,373
Messages
6,124,559
Members
449,171
Latest member
jominadeo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top