View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
Ken Ken is offline
external usenet poster
 
Posts: 590
Default Looking for formula

Hi Joel,

I tried your suggested formula in the actual spreadsheet and in a blank
spreadsheet with the data below with no success. I'm still getting the same
error message even in the new spreadsheet using column A2-A17.

Your thoughts?

Best Regards,

"joel" wrote:

The MID function requires 3 parameters the last being the length. MID will
return either the number of character to the end of the string, or the number
of characters specified by the 3rd parameter (len in this case). I want to
reutrn all the character to the end of the string so I could of specified 256
characters to make the code simplier. I choose the length to use the length
of the string which will always be greater than the number of characters I
really need.

What the formula does is searches for the first space in the string and
returns all the character after the space. the FIND() part of the function
returns the character position of the space. I don't want the space in the
final results so I add 1 (+1) so I ignore the space.

I think the error is because of the 2 spaces. The TIMEVALUE isn't
recognizing the the time with the extra space. Try this change. I assume
your times are in cell H2 to H17. I tested both my old formula and new
formula with your posted data and didn't get an error. It is possible there
is some white characters (looks like spaces but aren't) in you string (like
tabs). I checked and my suspicion were correct. the two characters between
the date and time are 32 and 160 (32 + 128). Both are spaces. I have no
idea how you got a charcter 160! This formula will work in either case.

=SUMPRODUCT(--(TIMEVALUE(Trim(MID(H2:H17,FIND("
",H2:H17),LEN(H2:H17))))=TIME(15,0,0)),--(TIMEVALUE(trim(MID(H2:H17,FIND("
",H2:H17),LEN(H2:H17))))<=TIME(18,0,0)))


This is what I used to find the character 160
=CODE(MID($H$2,11,1)) - return 160
=CODE(MID($H$2,12,1)) - return 32
=CODE(MID($H$2,13,1)) - return 53 the character 5


"Ken" wrote:

Hi Joel,

When I try the following it gives me a value error
"A value used in the formula is of the wrong data type"

=SUMPRODUCT(--(TIMEVALUE(MID(H2:H17,FIND("
",H2:H17)+1,LEN(H2:H17)))=TIME(15,0,0)),--(TIMEVALUE(MID(H2:H17,FIND("
",H2:H17)+1,LEN(H2:H17)))<=TIME(18,0,0)))

Unfortunately, I cannot remove the spaces to make the formula simpler. What
does the +1,LEN(H2:H17) portion do in this formula?

Best Regards,

"joel" wrote:

Not sure if you date is in column A and time in Column B or both the time and
date are in the same column


Column B contain just time
=SUMPRODUCT(--(B2:B17=TIME(15,0,0)),--(B2:B17<=TIME(18,0,0)))

If the time and date are both in column A there is two spaces between the
time and date which is causing a problem. I had to use the MID function to
get past the extra space. If you could eliminate the extra space it would
make the formula simplier.

=SUMPRODUCT(--(TIMEVALUE(MID(A2:A17,FIND("
",A2:A17)+1,LEN(A2:A17)))=TIME(15,0,0)),--(TIMEVALUE(MID(A2:A17,FIND("
",A2:A17)+1,LEN(A2:A17)))<=TIME(18,0,0)))



"Ken" wrote:

Looking for help...

I manage a closed ticket report and I need to find a formula that will find
all tickets in a certain time range.

For instance, in the list below, how would I write a formula to count all
tickets that came in between 3:00:00 PM and 6:00:00 PM (The date is not
important)?

H

TIME_ACTION_TAKEN
02/10/2009 5:09:32 PM
02/02/2009 10:48:03 AM
02/04/2009 8:46:08 AM
02/02/2009 4:29:31 PM
02/02/2009 6:59:39 PM
02/02/2009 6:24:48 PM
02/03/2009 1:46:16 AM
02/06/2009 3:49:10 PM
02/04/2009 10:40:35 AM
02/05/2009 2:04:34 PM
02/05/2009 2:11:17 PM
02/10/2009 6:18:17 PM
02/04/2009 7:56:45 PM
02/04/2009 8:27:22 PM
02/05/2009 7:03:33 PM
02/13/2009 9:51:25 AM

Appreciate the help!

Regards,

Ken