ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Need IF/THEN formula for date present (https://www.excelbanter.com/excel-worksheet-functions/170634-need-if-then-formula-date-present.html)

Amatuer

Need IF/THEN formula for date present
 
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!

T. Valko

Need IF/THEN formula for date present
 
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

--
Biff
Microsoft Excel MVP


"Amatuer" wrote in message
...
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!




Amatuer

Need IF/THEN formula for date present
 
You are truly a genius - it works beautifully - thanks!!!

"T. Valko" wrote:

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

--
Biff
Microsoft Excel MVP


"Amatuer" wrote in message
...
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!





T. Valko

Need IF/THEN formula for date present
 
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,"")


--
Biff
Microsoft Excel MVP


"Amatuer" wrote in message
...
You are truly a genius - it works beautifully - thanks!!!

"T. Valko" wrote:

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

--
Biff
Microsoft Excel MVP


"Amatuer" wrote in message
...
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!







Rick Rothstein \(MVP - VB\)

Need IF/THEN formula for date present
 
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,"")


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


Anssi

Need IF/THEN formula for date present
 
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

--
- Anssi -


"T. Valko" kirjoitti:

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,"")


--
Biff
Microsoft Excel MVP


"Amatuer" wrote in message
...
You are truly a genius - it works beautifully - thanks!!!

"T. Valko" wrote:

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

--
Biff
Microsoft Excel MVP


"Amatuer" wrote in message
...
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!







T. Valko

Need IF/THEN formula for date present
 
I only understand English (sometimes!).

--
Biff
Microsoft Excel MVP


"Anssi" wrote in message
...
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

--
- Anssi -


"T. Valko" kirjoitti:

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,"")


--
Biff
Microsoft Excel MVP


"Amatuer" wrote in message
...
You are truly a genius - it works beautifully - thanks!!!

"T. Valko" wrote:

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

--
Biff
Microsoft Excel MVP


"Amatuer" wrote in message
...
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!










All times are GMT +1. The time now is 05:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com