Finding the closest value to a given cell within a column, matching 2 variables (a date and an item part number)

Vermilion

New Member
Joined
Jan 30, 2015
Messages
1
Hello, I am using Excel 2010 and I have this issue:

I have an inventory table where I register the entry of products.
Every time there is an entry of product, I should register its part number, the date of the entry, and the most recent day before the current entry.

Therefore, I am looking for a formula that automatically allows me to identify the closest date before the current entry of data I mentioned; however, it should only look within the dates that correspond to the item in the row.

Something like this:


[TABLE="width: 238"]
<tbody>[TR]
[TD]Item
[/TD]
[TD="align: center"]Date
[/TD]
[TD]Result[/TD]
[/TR]
[TR]
[TD]X[/TD]
[TD]January-01-01[/TD]
[TD]January-01-01[/TD]
[/TR]
[TR]
[TD]Y[/TD]
[TD]February-01-01[/TD]
[TD]February-01-01[/TD]
[/TR]
[TR]
[TD]Z[/TD]
[TD]March-01-01[/TD]
[TD]March-01-01[/TD]
[/TR]
[TR]
[TD]X[/TD]
[TD]October-01-01[/TD]
[TD]July-01-01[/TD]
[/TR]
[TR]
[TD]X[/TD]
[TD]July-01-01[/TD]
[TD]January-01-01[/TD]
[/TR]
</tbody>[/TABLE]


Then, I want to know the position of the cell which contains my result:

[TABLE="width: 238"]
<tbody>[TR]
[TD="align: center"]Item
[/TD]
[TD="align: center"]Date[/TD]
[TD="align: center"]Result[/TD]
[/TR]
[TR]
[TD]X[/TD]
[TD]January-01-01[/TD]
[TD="align: center"]B1[/TD]
[/TR]
[TR]
[TD]Y[/TD]
[TD]February-01-01[/TD]
[TD="align: center"]B2[/TD]
[/TR]
[TR]
[TD]Z[/TD]
[TD]March-01-01[/TD]
[TD="align: center"]B3[/TD]
[/TR]
[TR]
[TD]X[/TD]
[TD]October-01-01[/TD]
[TD="align: center"]B5[/TD]
[/TR]
[TR]
[TD]X[/TD]
[TD]July-01-01[/TD]
[TD="align: center"]B1[/TD]
[/TR]
</tbody>[/TABLE]


And finally, I want to change the column (for example to column F):

[TABLE="width: 238"]
<tbody>[TR]
[TD="align: center"]Item
[/TD]
[TD="align: center"]Date[/TD]
[TD="align: center"]Result[/TD]
[/TR]
[TR]
[TD]X[/TD]
[TD]January-01-01[/TD]
[TD="align: center"]F1[/TD]
[/TR]
[TR]
[TD]Y[/TD]
[TD]February-01-01[/TD]
[TD="align: center"]F2[/TD]
[/TR]
[TR]
[TD]Z[/TD]
[TD]March-01-01[/TD]
[TD="align: center"]F3[/TD]
[/TR]
[TR]
[TD]X[/TD]
[TD]October-01-01[/TD]
[TD="align: center"]F5[/TD]
[/TR]
[TR]
[TD]X[/TD]
[TD]July-01-01[/TD]
[TD="align: center"]F1[/TD]
[/TR]
</tbody>[/TABLE]


PD. I cannot use a macro, because that function is blocked per company policy.

Any ideas?
Thank you!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

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