Formula to put specific hour within a set time range

eckecko

New Member
Joined
Jun 27, 2013
Messages
2
Good afternoon. I hope everyone is having an awesome day. :) I would like to ask a question please.

I have a sheet that shows the time customers call. I need to put different hours into a specific time range. Thus I have set up the following table:

Start TimeEnd TimeRange
9:0111:009:01 AM - 11 AM
11:0113:0011:01 AM - 1 PM
13:0115:001:01 PM - 3 PM
15:0117:003:01 PM - 5 PM
17:0119:005:01 PM - 7 PM
19:0121:007:01 PM - 9 PM
21:019:009:01 PM - 9 AM

<tbody>
</tbody>

I am using the following formula:

=IF(AND(J2>=' Reference Tables'!$A$2,'Raw Data'!J2<=' Reference Tables'!$B$2),' Reference Tables'!$C$2,
IF(AND(J2>=' Reference Tables'!$A$3,'Raw Data'!J2<=' Reference Tables'!$B$3),' Reference Tables'!$C$3,
IF(AND(J2>=' Reference Tables'!$A$4,'Raw Data'!J2<=' Reference Tables'!$B$4),' Reference Tables'!$C$4,
IF(AND(J2>=' Reference Tables'!$A$5,'Raw Data'!J2<=' Reference Tables'!$B$5),' Reference Tables'!$C$5,
IF(AND(J2>=' Reference Tables'!$A$6,'Raw Data'!J2<=' Reference Tables'!$B$6),' Reference Tables'!$C$6,
IF(AND(J2>=' Reference Tables'!$A$7,'Raw Data'!J2<=' Reference Tables'!$B$7),' Reference Tables'!$C$7,
IF(AND(J2>=' Reference Tables'!$A$8,'Raw Data'!J2<=' Reference Tables'!$B$8),' Reference Tables'!$C$8,"No Time Recorded")))))))

A call received at 8AM for example should be within the 9PM and 9AM time range. People that call at 12PM should be in the 11AM-13PM but I get the message "No time recorded." Can someone please tell me what I am doing wrong? Thank you!

Below is a sample of the erroneous results:

TimeCall Received Hour Range
-No Time Recorded
-No Time Recorded
-No Time Recorded
-No Time Recorded
12:30 AMNo Time Recorded
No Time Recorded
No Time Recorded
No Time Recorded
No Time Recorded
No Time Recorded
No Time Recorded
No Time Recorded
No Time Recorded
No Time Recorded
No Time Recorded
No Time Recorded
No Time Recorded
8:00 AMNo Time Recorded
12:00 PMNo Time Recorded
12:00 PMNo Time Recorded

<tbody>
</tbody>

Thank you for your time.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Welcome to MrExcel.

Use a lookup table:

Excel VLookup Function Examples

It must be in ascending order so insert a row at the beginning to cover 00:01 to 09:00.

For your formula to work you would need to add a day to times before 09:01 and also to the 09:00 in B8.
 
Upvote 0
It worked! Thank you so much. I am learning to use VLOOKUP. I also used the =IFERROR for those cells that were blank. Thanks again. Have a wonderful day!
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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