# if condition for dates difference

1. ## if condition for dates difference

Hi,

Can somebody help me with if condition for the below criteria.

if my A cell value is date then it should find the days difference between C cell date and A cell date and give me the result as number of days otherwise return the A cell value only.

Regards,
Vimala K

2. ## Re: if condition for dates difference

Hi,

See if the following formula works for you.

=IFERROR(C1-A1,A1)

Dates in Excel are actually numbers formatted to look like dates. We can check if a cell contains number by using ISNUMBER or multiplying the cells by 1 etc., however, we cannot confirm if the number is actually a DATE without the help of VBA.

Please go through the following URL for help on how to check if a cell value is date by using VBA

3. ## Re: if condition for dates difference

Hi
check this

A Column B Column C Column
Date Result Cut off
4/30/2017 6/30/2017
4/30/2017
NA
5/18/2017
3/22/2017
5/25/2017

As per the above information, I need the if formula in b column which gives the difference days of A and C column otherwise it should return NA as per A column

4. ## Re: if condition for dates difference

I'm not convinced that that isparticularly robust. If you can specify that the date (for example) MUST bein 2016, then a simple check to see that the value is:

a) a number,
b) >=42370
c) <=42735

5. ## Re: if condition for dates difference

As mentioned by Glen, do you have any Upper & Lower limits for the dates?

e.g., Dates can be say, from 2016, to 2017 or 2017 to 2018 etc.

6. ## Re: if condition for dates difference

A column dates can be of any year but C column will be the current month date. but most probably current year will be there in A column. and i need the total number of days between these two dates.

7. ## Re: if condition for dates difference

Limited to 2017 dates, only...

=IF(AND(A1>=DATE(2017,1,1),A1<=DATE(2017,12,31)),\$C\$1-A1,"NA")

8. ## Re: if condition for dates difference

Ok. Will try and get back to you if i face any challenges.

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1