Ruturn values from Table from time range

mole999

Well-known Member
Joined
Oct 23, 2004
Messages
10,524
Office Version
  1. 2019
  2. 2016
  3. 2013
Platform
  1. Windows
I need to return Start and Start2 separately, when a time supplied is between length and length2. Currently 5 IFs but need to extend to 13 periods



lengthlength2StartStart2test
05:59:590000
06:00:0006:29:5902:00:0004:00:001 07:29:00
06:30:0006:59:5902:30:0004:30:002
07:00:0007:29:5903:00:0005:00:003
07:30:0007:59:5903:30:0005:30:004
08:00:0008:29:5902:30:0004:30:005
08:30:0008:59:5903:00:0006:00:006
09:00:0009:29:5903:30:0006:30:007
09:30:0009:59:5904:00:0007:00:008
10:00:0010:29:5904:00:0007:00:009
10:30:0010:59:5904:30:0007:30:0010
11:00:0011:29:5904:30:0007:30:0011
11:30:0011:59:5904:30:0007:30:0012
12:00:0012:29:5904:30:0007:30:0013

<tbody>
</tbody>
 
Last edited:

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
These two should work:

=LOOKUP(G3,A2:A15,C2:C15)
=LOOKUP(G3,A2:A15,D2:D15)

I presume the first length and length2 are mixed up?
 
Upvote 0
These two should work:

=LOOKUP(G3,A2:A15,C2:C15)
=LOOKUP(G3,A2:A15,D2:D15)

I presume the first length and length2 are mixed up?

I was way off with MATCH OR. Times should be right for thirty minute intervals and the 8 oclock is as intended to be
 
Upvote 0
You should be aware the lookup method has no upper bound limit after 12:00 based on your current table so if you arent completing all half hour intervals then it could produce erroneous results such as if you tested 13:00:00. This time isnt available in your table but would produce a result. If that matters you could use:

=INDEX(C2:C15,MATCH(1,INDEX((A2:A15<=G3)*(B2:B15>=G3),0),0))
 
Upvote 0
maximum is a 12 hour planned shift, the first bit appears to bean error in my play table, and nothing untoward or special
 
Upvote 0

Forum statistics

Threads
1,214,991
Messages
6,122,628
Members
449,095
Latest member
bsb1122

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