ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Another date formula (https://www.excelbanter.com/excel-worksheet-functions/225715-another-date-formula.html)

nibbana

Another date formula
 
Here's my data:

A B
1 1-Jun-08 1-Jul-08
2 30-Jun-08 31-Jul-08

I need a formula in B1 and B2 that will:

If col A date is first day of month then return first day of next month; or
If col A date is last day of month then return last day of next month.

Thanks!

macropod[_2_]

Another date formula
 
Hi nibbana,

For A1/B1:
=DATE(Year(A1),MONTH(A1)+1,1)
For A2/B2:
=DATE(Year(A2),MONTH(A1)+2,0)

--
Cheers
macropod
[MVP - Microsoft Word]


"nibbana" wrote in message ...
Here's my data:

A B
1 1-Jun-08 1-Jul-08
2 30-Jun-08 31-Jul-08

I need a formula in B1 and B2 that will:

If col A date is first day of month then return first day of next month; or
If col A date is last day of month then return last day of next month.

Thanks!


JBeaucaire[_90_]

Another date formula
 
In B1 and copied down:

=IF(MONTH((DATE(YEAR(A1),MONTH(A1),DAY(A1))+1))MO NTH(A1),
DATE(YEAR(A1),MONTH(A1)+2,1)-1,
DATE(YEAR(A1),MONTH(A1)+1,DAY(A1)))

--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.


"nibbana" wrote:

Here's my data:

A B
1 1-Jun-08 1-Jul-08
2 30-Jun-08 31-Jul-08

I need a formula in B1 and B2 that will:

If col A date is first day of month then return first day of next month; or
If col A date is last day of month then return last day of next month.

Thanks!


JBeaucaire[_90_]

Another date formula
 
We don't have to work so hard on the IF test:

=IF(MONTH(A1+1)MONTH(A1),
DATE(YEAR(A1),MONTH(A1)+2,1)-1,
DATE(YEAR(A1),MONTH(A1)+1,DAY(A1)))

--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.


"nibbana" wrote:

Here's my data:

A B
1 1-Jun-08 1-Jul-08
2 30-Jun-08 31-Jul-08

I need a formula in B1 and B2 that will:

If col A date is first day of month then return first day of next month; or
If col A date is last day of month then return last day of next month.

Thanks!


nibbana

Another date formula
 
Turns out I don't need the if scenario. so these simple ones worked great,
thanks.

"macropod" wrote:

Hi nibbana,

For A1/B1:
=DATE(Year(A1),MONTH(A1)+1,1)
For A2/B2:
=DATE(Year(A2),MONTH(A1)+2,0)

--
Cheers
macropod
[MVP - Microsoft Word]


"nibbana" wrote in message ...
Here's my data:

A B
1 1-Jun-08 1-Jul-08
2 30-Jun-08 31-Jul-08

I need a formula in B1 and B2 that will:

If col A date is first day of month then return first day of next month; or
If col A date is last day of month then return last day of next month.

Thanks!




All times are GMT +1. The time now is 03:56 PM.

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