ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   need help with 'counting' between values (https://www.excelbanter.com/excel-programming/354616-need-help-counting-between-values.html)

Johnny Mick[_2_]

need help with 'counting' between values
 
Good afternoon,

I believe I have a simple task at hand, I just cannot come up with a way to
programmatically achieve the desired results. I have a column that has time
values displayed. I need to count (and display in cell c118) all of those
times that are between 8:00 and 8:59. Then count (and display in cell c119)
all of those times that are between 9:00 and 10:00; and so on, until probably
20:00.

I am a rookie, so I failed at trying to use an array to accomplish. I ended
up with 10 'For' loops, and even then it still didn't work the way it was
supposed to . Any and all assistance would be greatly appreciated. Thanks.

Bob Phillips[_6_]

need help with 'counting' between values
 
In A118 enter 08:00
In B118 enter 09:00
in C118 enter =SUMPRODUCT(--(M1:M100-A118),--(M1:M100<B118))

etc.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Johnny Mick" wrote in message
...
Good afternoon,

I believe I have a simple task at hand, I just cannot come up with a way

to
programmatically achieve the desired results. I have a column that has

time
values displayed. I need to count (and display in cell c118) all of those
times that are between 8:00 and 8:59. Then count (and display in cell

c119)
all of those times that are between 9:00 and 10:00; and so on, until

probably
20:00.

I am a rookie, so I failed at trying to use an array to accomplish. I

ended
up with 10 'For' loops, and even then it still didn't work the way it was
supposed to . Any and all assistance would be greatly appreciated.

Thanks.



Johnny Mick[_2_]

need help with 'counting' between values
 
Mr. Phillips,
Please excuse my ignorance. I wasn't quite sure how to word the question.
The example you provided works very well for the 'question' I posed; what I
was really trying to do though, was 'count' the line item that has a time
between 8:00 and 9:00; and so on. So instead totaling the times listed in
the column, I was looking more for something like a 'countif' type scenario.
I just can't figure out how to set it up as an array/loop. I am an amateur
at best, when it comes to writing macros, so my solution was to write a 'for
loop and count the time slot (8:00-9:00, etc.. . ), so that I didn't have to
write one for each time slot' Anyway. Thank you very much for the speedy
response. Stumbling onto this link has been a godsend.

"Bob Phillips" wrote:

In A118 enter 08:00
In B118 enter 09:00
in C118 enter =SUMPRODUCT(--(M1:M100-A118),--(M1:M100<B118))

etc.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Johnny Mick" wrote in message
...
Good afternoon,

I believe I have a simple task at hand, I just cannot come up with a way

to
programmatically achieve the desired results. I have a column that has

time
values displayed. I need to count (and display in cell c118) all of those
times that are between 8:00 and 8:59. Then count (and display in cell

c119)
all of those times that are between 9:00 and 10:00; and so on, until

probably
20:00.

I am a rookie, so I failed at trying to use an array to accomplish. I

ended
up with 10 'For' loops, and even then it still didn't work the way it was
supposed to . Any and all assistance would be greatly appreciated.

Thanks.




Bob Phillips[_6_]

need help with 'counting' between values
 
Johnny,

That is a countif scenario, count if times after 7:59 and before 9:00.

Give a data example and expected results.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Johnny Mick" wrote in message
...
Mr. Phillips,
Please excuse my ignorance. I wasn't quite sure how to word the question.
The example you provided works very well for the 'question' I posed; what

I
was really trying to do though, was 'count' the line item that has a time
between 8:00 and 9:00; and so on. So instead totaling the times listed in
the column, I was looking more for something like a 'countif' type

scenario.
I just can't figure out how to set it up as an array/loop. I am an

amateur
at best, when it comes to writing macros, so my solution was to write a

'for
loop and count the time slot (8:00-9:00, etc.. . ), so that I didn't have

to
write one for each time slot' Anyway. Thank you very much for the speedy
response. Stumbling onto this link has been a godsend.

"Bob Phillips" wrote:

In A118 enter 08:00
In B118 enter 09:00
in C118 enter =SUMPRODUCT(--(M1:M100-A118),--(M1:M100<B118))

etc.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Johnny Mick" wrote in message
...
Good afternoon,

I believe I have a simple task at hand, I just cannot come up with a

way
to
programmatically achieve the desired results. I have a column that

has
time
values displayed. I need to count (and display in cell c118) all of

those
times that are between 8:00 and 8:59. Then count (and display in cell

c119)
all of those times that are between 9:00 and 10:00; and so on, until

probably
20:00.

I am a rookie, so I failed at trying to use an array to accomplish. I

ended
up with 10 'For' loops, and even then it still didn't work the way it

was
supposed to . Any and all assistance would be greatly appreciated.

Thanks.







All times are GMT +1. The time now is 10:45 PM.

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