PDA

View Full Version : A Counting loop required



Daniel3581
02-28-2006, 02:12 AM
I need some sort of counting loop to count number on the spreadsheet attached (please note, I have attached the spreadsheet, and put comments on what is require in cell D2)

Any assistance would be greatly appreaciated. I'm going nuts trying to figure this out. :banghead:

Thankyou.

Bob Phillips
02-28-2006, 03:03 AM
.

Daniel3581
02-28-2006, 03:22 AM
xld,

Thanks for the assistance, but the solution was not exaclty what I was looking for. I need a code that has to allow for the rows not being in the same place all the time (ie it need to have relative cell referencing, for any change in row number that occurs when new data is entered (ie a new row is entered into with the same work request number).

Cheers

XLGibbs
02-28-2006, 07:24 PM
If a new row is inserted within the ranges, the absolute references will adjust. You could possibly use a named range set up, but that would rely on a fixed amount of workorders..and does not seem like what you need.

A formula to adjust for new rows entered would need some type of method to determine how many rows to include. The offset formula could be used to refer to the top DarkBlue count and use that number to set the number of rows to include in the formula, but since those positions will change as well...would not be reliable.

the formula also appears to be able to be dragged all the way down the column and the row references adjust accordingly.

Daniel3581
02-28-2006, 07:37 PM
and just to make matters worse, all data on this sheet gets deleted every day, and reformatted once the raw data comes out of an access database (therefore I cannot have any on-sheet formula, it has to all be in VBA):igiveup:

XLGibbs
02-28-2006, 07:41 PM
Well, if it is all being done in VBA, just do the counting in VBA as well and place the values in the cells. That way the formula is not so much an issue.

Do you have code to get the data in? I assume you are working on code to format it...maybe in another post? You could certainly do the formatting and such, and tie in a count that can be placed in column D.

Daniel3581
02-28-2006, 07:46 PM
Good idea.... might give that a try, and I'll let you know how i go.