Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-12-2012, 04:47 AM
caz46 caz46 is offline Help with DATEDIF Formula Windows 7 32bit Help with DATEDIF Formula Office 2007
Advanced Beginner
Help with DATEDIF Formula
 
Join Date: Feb 2011
Posts: 73
caz46 is on a distinguished road
Default Help with DATEDIF Formula

Hi,

I have a Spreadsheet as follows and used a DATEDIF formula to return the number of months:


01-Jan-12 29-Mar-12 3
01-Jan-12 29-Mar-12 3
01-Jan-12 29-Mar-12 3



=IF(DATEDIF(A4,B4,"m")=0,"",DATEDIF(A4,B4,"m"))+CE ILING(DATEDIF(A4,B4,"md")/30,0.5)&""

I would like to add another column which if for example todays date is within the month of January it will return the remaining months of 2 etc.

Rather copying the current formula than adding to it, would I be better off creating a fresh one in the new cell, if so what would you recommend?

If it is best to add to the current one, how could this be done?

Thanks in advance
Reply With Quote
  #2  
Old 01-12-2012, 06:08 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Help with DATEDIF Formula Windows XP Help with DATEDIF Formula Office 2003
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,779
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

Quote:
I would like to add another column which if for example todays date is within the month of January it will return the remaining months of 2 etc.
Hi

and don't quite grasp what you want to do

EDIT BTW in your example DATEDIF is 2, not 3 I think
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
  #3  
Old 01-12-2012, 06:45 AM
caz46 caz46 is offline Help with DATEDIF Formula Windows 7 32bit Help with DATEDIF Formula Office 2007
Advanced Beginner
Help with DATEDIF Formula
 
Join Date: Feb 2011
Posts: 73
caz46 is on a distinguished road
Default

Hi,

I am using this formula and it is coming out to be 3 which is correct. We are now for example in January and as we do not count any months that have started I want to calculate the remaining months from the February to the end date on the sheet.

Example we are in January so the equation would return the following results

01-Jan-12 29-Mar-12 2
01-Jan-12 29-April-12 3
01-Jan-12 29-June-12 5

Hope this is clearer.
Reply With Quote
  #4  
Old 01-12-2012, 06:57 AM
Colin Legg's Avatar
Colin Legg Colin Legg is offline Help with DATEDIF Formula Windows 7 32bit Help with DATEDIF Formula Office 2010 32bit
Expert
 
Join Date: Jan 2011
Location: UK
Posts: 369
Colin Legg will become famous soon enough
Default

Using your current formula as a basis, this seems to give the results you want:

Code:
=IF(DATEDIF(MAX(A4,$D$2),B4,"m")=0,"",
    DATEDIF(MAX(A4,$D$2),B4,"m"))+
    CEILING(DATEDIF(MAX(A4,$D$2),B4,"md")/30,0.5)&""
Where D2 has either of these formulae which calculate the 1st day of the next month from today's date:
Code:
=DATE(YEAR(TODAY()),MONTH(TODAY())+1,1)
 
or
 
=EOMONTH(TODAY(),0)+1
__________________
Colin

RAD Excel Blog
Reply With Quote
  #5  
Old 01-12-2012, 06:58 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Help with DATEDIF Formula Windows XP Help with DATEDIF Formula Office 2003
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,779
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

I don't get it, as Datedif counts complete months between two dates,

=Datedif(01/01/2012,29/03/2012,"m") equates to 2 for me, not 3
So =datedif(01/02/2012,29/03/2012,"m") would yield 1
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
  #6  
Old 01-12-2012, 07:56 AM
caz46 caz46 is offline Help with DATEDIF Formula Windows 7 32bit Help with DATEDIF Formula Office 2007
Advanced Beginner
Help with DATEDIF Formula
 
Join Date: Feb 2011
Posts: 73
caz46 is on a distinguished road
Default

Thanks Colin, but I can't seem to get them to return the results I would expect. The results they are returning are as follows:


Formula1 3
Formula2 01/02/2012
Formula3 40940

The result should in face be 2 as Jan - March is 3 months, we do not want to include the current month (Jan) so want the formula to calculate from Feb - March which would me 2 remaining months.

Your second formula is similar to what I have been trying to do but just can't seem to get it to work.
Reply With Quote
  #7  
Old 01-12-2012, 08:17 AM
Colin Legg's Avatar
Colin Legg Colin Legg is offline Help with DATEDIF Formula Windows 7 32bit Help with DATEDIF Formula Office 2010 32bit
Expert
 
Join Date: Jan 2011
Location: UK
Posts: 369
Colin Legg will become famous soon enough
Default

Hi Caz,

I've attached an example which implements the formulae I posted above. For 1 Jan 12 vs. 29 Mar 12 it gives the result of 2 which I believe is what you want.

Note the formula in D2 is just a helper, so that the formulae in D4 to D9 are simpler.


If it's not returning the correct results then please elaborate.
Attached Files
File Type: xls Book1.xls (14.5 KB, 7 views)
__________________
Colin

RAD Excel Blog
Reply With Quote
  #8  
Old 01-12-2012, 08:46 AM
caz46 caz46 is offline Help with DATEDIF Formula Windows 7 32bit Help with DATEDIF Formula Office 2007
Advanced Beginner
Help with DATEDIF Formula
 
Join Date: Feb 2011
Posts: 73
caz46 is on a distinguished road
Default

Yes I see what you've done now. Thanks very much that works a treat.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
help with a look up or if formula beb1227 Excel 3 12-31-2011 01:08 PM
Help with DATEDIF Formula help with formula? doczilla Excel 2 09-25-2011 04:14 PM
Help with DATEDIF Formula Help with Formula Corca Excel 6 02-22-2010 09:40 PM
Help with DATEDIF Formula If formula sixhobbits Excel 1 10-02-2009 08:02 AM
Help for formula dehann Excel 5 05-01-2009 10:44 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:40 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft