ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calculating number of days in month (https://www.excelbanter.com/excel-programming/285782-calculating-number-days-month.html)

Jeff Armstrong

Calculating number of days in month
 
I have statistical data about various network components.
The statistics are captured daily. The data comes to me
in the form of a space delimited text file. When I import
into excel the each row represents a days worth of data.
Depending on when the network component was placed into
service will determine the starting date. This means the
date will fluctuate for every component.

What I am trying to do is average the data by month. I
have 452 components that I am trying to do this for. As
such I will have 452 dates that the components went into
service. I need the macro to be able to determine what
day of the month the component went into service and move
down the list until it gets to a new month. Then go back
and insert a row to average all the previous months data.
Then continue on until it reaches the current day. I have
the code to insert the row and average the data. What I
need is the logic for the dates. Does anyone have any
ideas how I can go about solving this problem?

Jeff

Nigel[_8_]

Calculating number of days in month
 
Try this.....

Dim Mth As Integer
Mth = Month(Range("A1"))

or

Mth = Month(Cells(1,1))

Set the range required for the data cell or the index values of row,column
in the 2nd example

Cheers
Nigel


"Jeff Armstrong" wrote in message
...
I have statistical data about various network components.
The statistics are captured daily. The data comes to me
in the form of a space delimited text file. When I import
into excel the each row represents a days worth of data.
Depending on when the network component was placed into
service will determine the starting date. This means the
date will fluctuate for every component.

What I am trying to do is average the data by month. I
have 452 components that I am trying to do this for. As
such I will have 452 dates that the components went into
service. I need the macro to be able to determine what
day of the month the component went into service and move
down the list until it gets to a new month. Then go back
and insert a row to average all the previous months data.
Then continue on until it reaches the current day. I have
the code to insert the row and average the data. What I
need is the logic for the dates. Does anyone have any
ideas how I can go about solving this problem?

Jeff





----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---


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

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