ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   complex date function (https://www.excelbanter.com/excel-worksheet-functions/43085-complex-date-function.html)

tjb

complex date function
 
OK here's what I need:

A user enters a date in A1, A2 should count number of full months between
the date entered and the next September 1st. So if they enter 6/28/05 in A1,
A2 should read with the number 2 (counting the months of July and August).
If they enter 11/21/04 in A1, it should calculate to 9 and so on.

If they enter a date in A1 that is the first of a month, then it should
count that month as well. So if they enter 5/1/05 in A1, A2 should read 4.

Of course this is possible but I can't seem to figure it out. Any
suggestions?

Bob Phillips

=DATEDIF(A1,DATE(YEAR(TODAY())+(MONTH(TODAY())8), 9,1),"M")

--

HTH

RP
(remove nothere from the email address if mailing direct)


"tjb" wrote in message
...
OK here's what I need:

A user enters a date in A1, A2 should count number of full months between
the date entered and the next September 1st. So if they enter 6/28/05 in

A1,
A2 should read with the number 2 (counting the months of July and August).
If they enter 11/21/04 in A1, it should calculate to 9 and so on.

If they enter a date in A1 that is the first of a month, then it should
count that month as well. So if they enter 5/1/05 in A1, A2 should read

4.

Of course this is possible but I can't seem to figure it out. Any
suggestions?




N Harkawat

=DATEDIF(A1,DATE(2005,9,1),"m")

"tjb" wrote:

OK here's what I need:

A user enters a date in A1, A2 should count number of full months between
the date entered and the next September 1st. So if they enter 6/28/05 in A1,
A2 should read with the number 2 (counting the months of July and August).
If they enter 11/21/04 in A1, it should calculate to 9 and so on.

If they enter a date in A1 that is the first of a month, then it should
count that month as well. So if they enter 5/1/05 in A1, A2 should read 4.

Of course this is possible but I can't seem to figure it out. Any
suggestions?



All times are GMT +1. The time now is 08:18 PM.

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