If statement in Excel 2013 - if this date is 1 or more days past this date then

0

I'm trying to create a formula to compare the amount of days between two dates. Basically if one date (column D) is within 1 day of the previous date (column C), then "Yes" (in column E) if greater than 1 day then "No" (in Column E)

hthomas

Posted 2017-10-20T15:02:25.877

Reputation: 1

Answers

1

Dates (that do not include times) in Excel are basically numbers of days.  So, to get the number of days between two dates, just subtract.  If you want to check whether the two dates are the same ±1, use

=IF(ABS(D1-C1)<=1, "Yes", "No")

If you want to check only in one direction, leave out the ABS(…).

If the above doesn’t work, try typing

=D1-C1

into a cell (any cell other than C1 or D1; could be E1; could be Z1).  If that displays a number like 3 (for your example of D1 = 8/28/2017 and C1 = 8/25/2017), try

=ABS(D1-C1)

and in any event edit your question to tell us what happens.  (Don’t use comments.)  A screenshot may be useful.

If D1-C1 works but ABS(D1-C1), and your system is configured for a non-English language, you may need to figure out Excel’s translation for ABS (absolute value) in your language.

Other experiments that may be enlightening:

  • =C1
  • =C1-7
  • =D1
  • =D1-7

Scott

Posted 2017-10-20T15:02:25.877

Reputation: 17 653

I tried that and it did not work. For example, the dates are in this format: 8/28/2017. So for the first line, I need to compare how many days are between 8/28/2017(Column D) and 8/25/2017(Column C). – hthomas – 2017-10-20T15:36:27.107

@hthomas What results did you get that makes you think Scott's formula doesn't work? Are columns C and D formatted as dates or text? – B540Glenn – 2017-10-20T15:49:59.300

there were no results, just an error that popped up in the formula. I wrote it just like he said. Columns C and D are formatted as Short Date – hthomas – 2017-10-20T16:10:27.277