If a date falls between two values, then put in the value from the corresponding column

remobec

New Member
Joined
May 31, 2017
Messages
12
OK, so I have a bunch of microfilm rolls storing records of old newspapers. Each roll is numbered, but we're missing some and I'd like to determine what we're missing.

Here is what my data looks like. A is the number of the microfilm roll, B is the start date of that roll, C is the end date of that roll.

A --- B --- C
8 --- 18-Dec-09 --- 18-Jun-10
9 --- 18-Jun-10 --- 13-Oct-11
10 --- 13-Oct-11 --- 18-Jun-12


I would like to be able to have a date, say June 20, 1910. Then it would look at the specific, determine that date falls in Roll 9 and return a "9." If there is not microfilm for a date, it can do an error message or whatever.

Is there a way to do this?

Thank you,
Becky
 
Last edited:

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
remobec, Good afternoon.

Some doubts.....

a) Is your data at column B always in ASCENDING order?

b) Can the dates at column B be repeated?

Probably VLOOKUP or an INDEX + MATCH can help you.

We will wait for you answer.
 
Upvote 0
Generally, data in Column B is always in Ascending order and the dates in Column B are not repeated. There are a few weird outliers, but I can leave those out.
 
Upvote 0
remobec, Good afternoon.

Using your information as basis:

A2:A5 --> Roll numbers
B2:B5 --> START DATE
C2:C5 --> END DATE

Try to do:


E3 --> Date for looking

F3 --> formula -->
Code:
=IF(COUNTIFS(B2:B5,"<="&E3,C2:C5,">="&E3)=0,"NOT found", SUMPRODUCT((B2:B5<=E3)*(C2:C5>=E3)*(A2:A5)))

Attention:

Your example contains some end dates that match start dates.
This can not happen because it breaks the integrity of the data.

I made a small example for you.

I modified the final dates for two rolls of film.
I colored the end date of roll 10 and included roll 11 to show that there is a space of time where there is no film.
I imagine that is exactly what you are looking for.
If the searched date falls in a range of these the message will warn.

https://www.sendspace.com/file/59t16i

Is that what you want?

I hope it helps.
 
Upvote 0

Forum statistics

Threads
1,214,925
Messages
6,122,301
Members
449,078
Latest member
nonnakkong

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