Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 43
Default Difference between two dates with if statements

I'm a beginner...Please help

Dates are inputted in column M or H; but sometime dates are not required in
M and H which would leave it blank (if date is in column M there will not be
a date in column H and vice versa);

Cell B1 should always prompt today's date (=today())

I need column N to calculate days between them
example: B1=05/08/08 M=05/21/08 N should = 13
But if there's nothing in M and H it returns -39576
In that case I need "0" to be inputted verses -39576
and when B1 is greater then M/H column
I need the return to be "Past due "number of days between the dates"

Hope this makes sense.

Please help

Elena
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 461
Default Difference between two dates with if statements

Alright, this is untested so just give it a shot and let me know how it goes...

=If(Len(M1)<1,0,If(Or(B1M1),"Past Due "&B1-M1&" number of days between the
dates",M1-B1))

Let me know how that works

"Elena" wrote:

I'm a beginner...Please help

Dates are inputted in column M or H; but sometime dates are not required in
M and H which would leave it blank (if date is in column M there will not be
a date in column H and vice versa);

Cell B1 should always prompt today's date (=today())

I need column N to calculate days between them
example: B1=05/08/08 M=05/21/08 N should = 13
But if there's nothing in M and H it returns -39576
In that case I need "0" to be inputted verses -39576
and when B1 is greater then M/H column
I need the return to be "Past due "number of days between the dates"

Hope this makes sense.

Please help

Elena

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 913
Default Difference between two dates with if statements

On Thu, 8 May 2008 10:54:01 -0700, Elena
wrote:

I'm a beginner...Please help

Dates are inputted in column M or H; but sometime dates are not required in
M and H which would leave it blank (if date is in column M there will not be
a date in column H and vice versa);

Cell B1 should always prompt today's date (=today())

I need column N to calculate days between them
example: B1=05/08/08 M=05/21/08 N should = 13
But if there's nothing in M and H it returns -39576
In that case I need "0" to be inputted verses -39576
and when B1 is greater then M/H column
I need the return to be "Past due "number of days between the dates"

Hope this makes sense.

Please help

Elena


Try this:

In cell N1 put
=IF(H1="",IF(M1="",0,IF(M1<B$1,
"Past due "&B$1-M1,M1-B$1)),IF(H1<B$1,"Past due "&B$1-H1,H1-B$1))

This formula first looks in the H column to see if it is blank.
If it is blank the next check is to see if the M column is blank.
If that is also true then 0 is the result.
If M is not blank then a check is made to see if the date in the M
column is less than the date in B1 (i.e. TODAY).
If so the result is Past due... etc
Otherwise the result is just the difference between the date.
Finally, if the H column was not blank the same checks are done
and similar results as just described for the M column is returned.

Hope this helps. / Lars-Åke

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 353
Default Difference between two dates with if statements

=IF(AND(H1-$B$1<0,M1-$B$1<0,H1<M1),"Past due
"&-MAX(H1-$B$1,M1-$B$1),MAX(H1-$B$1,M1-$B$1,0))

Enter in N1 and copy down...
Hope this helps... or maybe that someone comes up with a shorter way... :-)

"Elena" wrote:

I'm a beginner...Please help

Dates are inputted in column M or H; but sometime dates are not required in
M and H which would leave it blank (if date is in column M there will not be
a date in column H and vice versa);

Cell B1 should always prompt today's date (=today())

I need column N to calculate days between them
example: B1=05/08/08 M=05/21/08 N should = 13
But if there's nothing in M and H it returns -39576
In that case I need "0" to be inputted verses -39576
and when B1 is greater then M/H column
I need the return to be "Past due "number of days between the dates"

Hope this makes sense.

Please help

Elena

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 913
Default Difference between two dates with if statements

This formula gives 0 if the same date, less than today, is put in
both H and M. It is not clear from the original post if there could be
dates in both H and M so it is hard to tell if this is a problem or
not.

The formula can be shortened a bit; the first of the $ in $B$1 can be
removed in 6 places.

/ Lars-Åke

On Thu, 8 May 2008 11:30:00 -0700, BoniM
wrote:

=IF(AND(H1-$B$1<0,M1-$B$1<0,H1<M1),"Past due
"&-MAX(H1-$B$1,M1-$B$1),MAX(H1-$B$1,M1-$B$1,0))




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 353
Default Difference between two dates with if statements

from original:
(if date is in column M there will not be
a date in column H and vice versa);


"Lars-Ã…ke Aspelin" wrote:

This formula gives 0 if the same date, less than today, is put in
both H and M. It is not clear from the original post if there could be
dates in both H and M so it is hard to tell if this is a problem or
not.

The formula can be shortened a bit; the first of the $ in $B$1 can be
removed in 6 places.

/ Lars-Ã…ke

On Thu, 8 May 2008 11:30:00 -0700, BoniM
wrote:

=IF(AND(H1-$B$1<0,M1-$B$1<0,H1<M1),"Past due
"&-MAX(H1-$B$1,M1-$B$1),MAX(H1-$B$1,M1-$B$1,0))



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between dates Khurum Excel Worksheet Functions 12 August 13th 08 12:53 AM
Difference of two dates Zafar Excel Worksheet Functions 3 July 26th 07 08:44 AM
difference between dates RGB Excel Discussion (Misc queries) 2 July 21st 06 12:42 PM
difference between dates Clash Excel Discussion (Misc queries) 4 May 26th 06 08:02 AM
difference between two dates dhouston1000 Excel Discussion (Misc queries) 2 August 24th 05 11:19 AM


All times are GMT +1. The time now is 02:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"