Find next bigger value in two-way lookup

Skovgaard

Board Regular
Joined
Oct 18, 2013
Messages
197
Office Version
  1. 365
Platform
  1. Windows
Hello Experts,

Hope you can help.
Below table shows a running balance on a stock in quantities.
My goal is to find, when a certain order can be delivered.

Using two Xlookup-functions, I'm able to find the result, if there's enough pcs on stock.
But if there isn't enough items on stock, then I need to find when there will be.

Example:
- Requested delivery date from customer: 2021-33
- Item1
- 5 pcs

Correct result should be "2021-35", hence complete delivery can be fulfilled.

Hope you understand the challenge, otherwise don't hesitate to write your questions.

Running stock balance:
Item no.: / YYYY-Week2021-312021-322021-332021-35
Item 1100325
Item 25101512
Item 3001015


/Skovgaard
 
Replaced FormulaR1C1 with Formula2R1C1 and it worked, thanks for your help!

/Ulrik
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
You're welcome. Glad you got it sorted. (y)

Re. the negative balance protection, I'm thinking that below test will do the trick. If it's true, then it is supposed to add one extra week.
I've tried, without luck, to make this test in VBA. I've tried different things, see below.

Anyone who can help with that?

1630328365374.png




VBA Code:
 If Application.WorksheetFunction.Min(Application.WorksheetFunction.Offset(PivotWeek, Application.WorksheetFunction.Match(item, PivotItem, 0) - 1, 0)) < 0 Then

'or
                                 
         Set rItem = Range("PivotWeek").Offset(Application.WorksheetFunction.Match(item, "PivotItem", 0) - 1, 0)

/Skovgaard
 
Upvote 0

Forum statistics

Threads
1,214,518
Messages
6,119,985
Members
448,935
Latest member
ijat

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