Simple Lookup?

tonyotter

Board Regular
Joined
Dec 14, 2006
Messages
58
There is probably a simple solution to this one but my brain is failing me!

in sheet 1 i have cells for users to enter any time from 0600 upto 1800
eg in A1 12:20 B1 15:04 C1 15:28
in A2 14:00 B2 15:12 C2 16:00

in sheet 2 I have numbers starting at 06:00 (in A1) down to 18:00 (in A721)
I am trying to get a formula within cells in column B which will return a 1 in the cells (B) next to the time in A if the time data in column A isqual to the time in Sheet 1 A1, including all times upto and including the time in A2.

So for example: where Sheet B1 = 15:04 and B2 = 15:12
Sheet 2 A544 is 15:03 so B544 is blank
A545 is 15:04 so B545 = 1
B546 through to B553 will show 1, then B554 will return blank.

I hope ths makes sense!!

I have tried a few methods for lookups and match, but to no avail. Any help is greatly recieved.
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
There is probably a simple solution to this one but my brain is failing me!

in sheet 1 i have cells for users to enter any time from 0600 upto 1800
eg in A1 12:20 B1 15:04 C1 15:28
in A2 14:00 B2 15:12 C2 16:00

in sheet 2 I have numbers starting at 06:00 (in A1) down to 18:00 (in A721)
I am trying to get a formula within cells in column B which will return a 1 in the cells (B) next to the time in A if the time data in column A isqual to the time in Sheet 1 A1, including all times upto and including the time in A2.

So for example: where Sheet B1 = 15:04 and B2 = 15:12
Sheet 2 A544 is 15:03 so B544 is blank
A545 is 15:04 so B545 = 1
B546 through to B553 will show 1, then B554 will return blank.

I hope ths makes sense!!

I have tried a few methods for lookups and match, but to no avail. Any help is greatly recieved.
Let's see if I got this straight...


Sheet1:
  • A1 = 6:05 AM
  • A2 = 6:08 AM
Is this what you want on sheet2:

Book1
AB
26:00 AM
36:01 AM
46:02 AM
56:03 AM
66:04 AM
76:05 AM1
86:06 AM1
96:07 AM1
106:08 AM1
116:09 AM
126:10 AM
136:11 AM
146:12 AM
156:13 AM
Sheet1

How did you fill the times in Sheet2?

Chances are when you try a "lookup" formula the times won't match due to "rounding errors".
 
Upvote 0
Thats exactly what I'm trying to do. But i need the formulas in Sheet2 B to apply to the data sets A1(start time),A2(finish time) and further sets in columns B, C, D, an E.
There will never be an overlap in finsh time and following start time.
 
Upvote 0
Thats exactly what I'm trying to do. But i need the formulas in Sheet2 B to apply to the data sets A1(start time),A2(finish time) and further sets in columns B, C, D, an E.
There will never be an overlap in finsh time and following start time.
Ugh!

5 sets of time periods! :eeek:

Here's an example of how to do it with 2 time periods. You'll be able to figure it out for the other 3!

Time periods on Sheet1:

Book1
AB
16:05 AM6:10 AM
26:08 AM6:11 AM
Sheet1

Results on Sheet2:

Book1
AB
26:00 AM
36:01 AM
46:02 AM
56:03 AM
66:04 AM
76:05 AM1
86:06 AM1
96:07 AM1
106:08 AM1
116:09 AM
126:10 AM1
136:11 AM1
146:12 AM
156:13 AM
Sheet2

Enter this formula on Sheet2 in cell B2:

=IF(AND(Sheet1!A$1<=A2,A2<=Sheet1!A$2),1,"")&IF(AND(Sheet1!B$1<=A2,A2<=Sheet1!B$2),1,"")

Copy down as needed.

You didn't answer my question about:

How did you fill the times in Sheet2?

Chances are when you try a "lookup" formula the times won't match due to "rounding errors".

Try it and see if it works out.
 
Upvote 0
Solution
The times in sheet2 were entered as general numbers seperated by a colon.
Anyway... the formula works a treat. exactly what I was striving for.

Many Thanks for your help.

Tony
 
Upvote 0

Forum statistics

Threads
1,224,514
Messages
6,179,223
Members
452,896
Latest member
IGT

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