ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   mONTH cOMPARISON (https://www.excelbanter.com/excel-programming/373546-month-comparison.html)

Roy

mONTH cOMPARISON
 
I have an excel spreadsheet that takes a date in cell b1 (1/25/206) and ads
7days to it (the new date becomes 2/1/2006) and ecords the new date in cell
b2. What I want to do is if the new value in (ie 2/1/2006) is in a differnt
monththan te originating date then cell b2 woould reocrd the word avg instead
of the date 2/1/2006. Howdo I do this? I am using vba.

Tom Ogilvy

mONTH cOMPARISON
 
In B2:
=if(month(B1+7)<Month(B1),"avg",B1+7)

format the cell as Date
--
Regards,
Tom Ogilvy



"Roy" wrote:

I have an excel spreadsheet that takes a date in cell b1 (1/25/206) and ads
7days to it (the new date becomes 2/1/2006) and ecords the new date in cell
b2. What I want to do is if the new value in (ie 2/1/2006) is in a differnt
monththan te originating date then cell b2 woould reocrd the word avg instead
of the date 2/1/2006. Howdo I do this? I am using vba.



All times are GMT +1. The time now is 02:48 AM.

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