I have window dates in two cells. For example:
Where
In cell d1 I have the date: 1/3/2014 7:00
I would like to look up the date in a/b and if d falls between those dates then I would like for it to return the code for the window.
Assuming you have multiple "windows" listed in order with no gaps perhaps try LOOKUP like
=LOOKUP(D1,A1:C10)
see example
Cell
a1 = 1/1/2014 8:00
b1 = 1/4/2014 10:00
c1 = 11
d1 = 1/3/2014 7:00
e1 =IF(AND($D$1-A1>0,B1-$D$1>0),C1,"outside")
You can use this, it will work even if the dates are not in order, as long as values in C column are numeric. It will return 0 if no match
=SUMPRODUCT((D1>=A1:A10)*(D1<=B1:B10)*C1:C10)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.