Return excact data if between 2 time stamps

troublesum08

New Member
Joined
May 8, 2011
Messages
7
Hi. I'm not sure of what formula will get the desired results, but here is what I'm trying to accomplish. I have a data table where column A lists "names", column B lists "items purchased" and column C lists "time purchased". I am trying to use a formula to show all information where items were purchased between the times 17:00:00 and 23:00:00. Can I use nested IF statements or some type of SUMPRODUCT formula? I have a non-changing list of names that can be used as a Vlookup reference if that works better. I am lost, any help is greatly appreciated.

This is my first post so have mercy on the newbie.

troublesum08
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Troublesum08,

Try the following array formula (you have to press CTRL+SHIFT+ENTER and not only ENTER after type the formula):

=SUM(IF(C2:C20<=TIME(23,0,0),IF(C2:C20>=TIME(17,0,0),B2:B20,0),0))<?XML:NAMESPACE PREFIX = TIME(23,0,0),IF(C2 /><TIME(23,0,0),IF(C2:C20><TIME(23,0,0),IF(C2:C20><TIME(23,0,0),IF(C2:C20><TIME(23,0,0),IF(C2:C20>

Markmzz
</TIME(23,0,0),IF(C2:C20>
</TIME(23,0,0),IF(C2:C20>
</TIME(23,0,0),IF(C2:C20>
</TIME(23,0,0),IF(C2:C20>
 
Last edited:
Upvote 0
Hi. I'm not sure of what formula will get the desired results, but here is what I'm trying to accomplish. I have a data table where column A lists "names", column B lists "items purchased" and column C lists "time purchased". I am trying to use a formula to show all information where items were purchased between the times 17:00:00 and 23:00:00. Can I use nested IF statements or some type of SUMPRODUCT formula? I have a non-changing list of names that can be used as a Vlookup reference if that works better. I am lost, any help is greatly appreciated.

This is my first post so have mercy on the newbie.

troublesum08
It sounds like you want to filter the data.

If this is your data:

Book1
ABC
2NamesItemsTime
3name1item15:44 AM
4name2item21:52 AM
5name3item311:55 PM
6name4item44:03 PM
7name5item57:47 PM
8name6item61:19 AM
9name7item76:14 AM
10name8item88:20 AM
11name9item91:11 PM
12name10item104:48 AM
13name11item1110:08 AM
14name12item123:56 PM
15name13item137:52 AM
16name14item143:16 AM
17name15item156:22 AM
18name16item161:16 PM
19name17item175:08 PM
20name18item186:06 PM
Sheet1

And you want to see only the data with a time between 5:00 PM and 11:00 pm (inclusive)...

Book1
ABC
2NamesItemsTime
7name5item57:47 PM
19name17item175:08 PM
20name18item186:06 PM
Sheet1

The easiest way to do that is to use autofilter.

How to apply that depends on what version of Excel you're using.
 
Upvote 0
Ty for the reply. I tried this formula and it doesn't return the information that occurred during the time frame. It doesn't address the names in column A at all.
 
Upvote 0
I'm using excel 2003. When trying to auto filter the criteria as greater than or equal to 17:00 AND less than or equal to 23:00, no records appear...I know there should be something showing and the time format is the same.

TY for your assistance

troublesum08
 
Upvote 0
Ty for the reply. I tried this formula and it doesn't return the information that occurred during the time frame. It doesn't address the names in column A at all.

Troublesum08,

You press CTRL+SHIFT+ENTER and not only ENTER after type the formula
=SUM(IF(C2:C20<=TIME(23,0,0),IF(C2:C20>=TIME(17,0,0),B2:B20,0),0))<?XML:NAMESPACE PREFIX = TIME(23,0,0),IF(C2 /><TIME(23,0,0),IF(C2:C20><TIME(23,0,0),IF(C2:C20><TIME(23,0,0),IF(C2:C20><TIME(23,0,0),IF(C2:C20>?

Could you explain better what you want with an example?

Markmzz
</TIME(23,0,0),IF(C2:C20></TIME(23,0,0),IF(C2:C20></TIME(23,0,0),IF(C2:C20></TIME(23,0,0),IF(C2:C20>
 
Upvote 0
I'm using excel 2003. When trying to auto filter the criteria as greater than or equal to 17:00 AND less than or equal to 23:00, no records appear...I know there should be something showing and the time format is the same.

TY for your assistance

troublesum08
Maybe your times are not true Excel times.

In Excel time is a numeric value that represents the fractional part of a day. It's simply formatted to look like a time entry.


For example...
  • 12:00 AM = 0
  • 8:00 AM = 0.33333333
  • 12:00 PM = 0.50
  • 6:00 PM = 0.750
Check and make sure your times are true Excel times. You can do that by testing that the time entry is a number.

If C3 contains a time entry:

=ISNUMBER(C3)

TRUE = a true time entry
FALSE = not a true time entry, probably a text string that looks like a time entry
 
Upvote 0
My number format results show as false when testing with the (IsNumber) formula. Here is a better example of what I'm trying to do. I need to get the results in table 2.
moz-screenshot-3.png




Thanks Again
 
Upvote 0
Hi troublesum08

Regarding your query to insert an image: You should either load your image to a photo sharing site and use the IMG tag along with the URL to the image on the photo sharing site, or you could try to show your table with the HTM maker.
 
Upvote 0
Sorry, here is an example since my image didn't work out right. I'm looking for results in table 2.

Table1...
NAME ITEM TIME
John pen 19:47
Mike paper 01:30
Tom ink 23:20

Table2...(Transaction results between 17:00 and 23:00)
NAME ITEM TIME
John pen 19:47
 
Upvote 0

Forum statistics

Threads
1,215,053
Messages
6,122,888
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top