Find interval in data set given a date (i.e. exact match not possible)

tanjan

New Member
Joined
Dec 1, 2013
Messages
4
I have a table with info on what state a given item is in at a specific point in time.

-----------------------------------------------------
Item | State | Start Date of State
------------------------------------------------------
Item1 | Not started | 2013-jan-1
Item1 | Being prepared | 2013-feb-5
Item1 | Online | 2013-mar-10
Item2 | Not started | 2013-jan-15
Item2 | Being prepared | 2013-mar-8
--------------------------------------------------------
“Item1” was in the “Being prepared” state in the interval 2013-jan-1 to 2013-feb-4 etc.

I would like a function that returns the State given Item name and a date as parameter.

I usually handle stuff like this by use of vlookup() og match(index()), but I can’t get a hang of it since the data given as parameter will normally not have an exact match in the data set.

Is it possible to come up with a function without having to use VBA?

... and if not, can someone help never-used-VBA-before with some simple VBA code for it?

Any help is much appreciated
tanjan
(My first post so I hope I have done it correctly)
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Try this...

<br />
Book1
ABCDEFG
1ItemStateStart Date of StateLookup
2Item1Not started2013-Jan-1ItemDateState
3Item1Being prepared2013-Feb-5Item12013-Feb-28Being prepared
4Item1Online2013-Mar-10
5Item2Not started2013-Jan-15
6Item2Being prepared2013-Mar-8
Sheet1
Cell Formulas
RangeFormula
G3=LOOKUP(2,1/((A2:A6=E3)*(C2:C6<=F3)),B2:B6)
 
Upvote 0
Hi again

Unfortunately it seems the formula does not perform in the context I use it.

I want to make an overview of states for the different items over time:


xxxxx | Week1 | Week2 | .... | Week52
----------------------------------------------
Item1 |
Item2 |
Item3 |

... and then showing the states by use of color inside the table

However, already after 20 cells the update of the table starts to be slow

Is there any better option regarding recalculation of the worksheet?

Thanks
Tanjan
 
Upvote 0
Hi again

It turned out the worksheet was somehow corrupted. After carefully moving the functionality to a new worksheet it works fine. Cumbersome ... but really nice.

Thanks again AlphaFrog :)
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,988
Members
452,373
Latest member
TimReeks

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