Need IF/THEN formula for date present

  • Thread starter Thread starter Amatuer
  • Start date Start date
A

Amatuer

I'm sure this is basic for most of you but it is baffling me:

I need a formula to subtract date column 1 from date column 2 (that part I
have) AND IF there is NOT a date in date column 2, subtract date column 1
from TODAY's date. Thanks!
 
Try somehting like this:

=IF(B2,B2,TODAY())-A2

Or, for something more robust:

=IF(COUNT(A2),IF(ISNUMBER(B2),B2,TODAY())-A2,"")

Format as GENERAL or NUMBER
 
You're welcome. Thanks for the feedback!
Or, for something more robust:
=IF(COUNT(A2),IF(ISNUMBER(B2),B2,TODAY())-A2,"")

Same result, a few keystrokes shorter:

=IF(COUNT(A2),IF(COUNT(B2),B2,TODAY())-A2,"")
 
Or, for something more robust:
Same result, a few keystrokes shorter:

=IF(COUNT(A2),IF(COUNT(B2),B2,TODAY())-A2,"")

If we make the assumption that if a date exists in B2, that it will always
be an earlier date than today, then we can save a few more keystrokes...

=IF(COUNT(A2),MIN(B2,TODAY())-A2,"")

or, if not always earlier, then if we assume it is always after today,
then...

=IF(COUNT(A2),MAX(B2,TODAY())-A2,"")

Rick
 
T. Valko -> oletko suomalainen? Jos olet, niin osaatko kertoa kuinka
suomenkielisessä Excelissä lasketaan montako riviä sisältää molemmat tiedot
esim. "ovi" ja "kimi"?

ovi ikkuna anssi kimi
seinä aita sipa tommi
taulu kaappi vesa mikko
ikkuna ovi anssi kimi
aita seinä sipa tommi
kaappi taulu vesa mikko
ovi ikkuna anssi kimi
seinä aita sipa tommi
taulu kaappi vesa mikko
 
Back
Top