Need help with look up formula

chadwood3232

New Member
Joined
Nov 22, 2011
Messages
20
Hello.

Table 1 "Raw Data" - This is raw data that is pulled giving me EAN/UPC #, the batch, next inspection date, expiration date and unit quantity.

Each EAN/UPC # will have multiple batches and different inspection and expiration dates.

Table 2 "Sls Plan" -Simply just the sales forecast by EAN/UPC by month.

Table 3 "

RawDataPT with Sales
" -A pivot table based on "Raw Data". Bringing in EAN/UPC, expiration date, and unit quantity. Then to the right I did lookup to bring in sales plan for that EAN/UPC #.

Tab 3 "Sls Plan" -Simply just the sales forecast by EAN/UPC by month.



So what I am trying to do is this on the "RawDataPT with Sales" I want to find a way to apply the sales forecast starting in column E row 6 for material 1(50 units). I would want to apply that to the date that expires first. Which is 01/31/205. So in this example for the item that expires on 01/31/2025 I currently have 158 units(cell C8) so for the Nov sales forecast units (50 units) I would want to apply 50 units to 01/31/2025. Then Dec take sales of 60 and apply to balance of the 01/31/2025. Then Jan apply 48 units to 01/31/2025 then use the balance 22 units to the next date that expires next which would be 05/31/2025.

Starting in row 35 i have mocked up a basic idea but not locked into that type of format. It doesn't need to be this format. It can look like anything i just need to apply sales forecast to each material (1 & 2) in this example until it gets to zero to ensure it is sold before it expires. Thank you to anyone that can help

Raw Data

onhandtest.xlsx
ABCDE
1EAN/UPCBatchNext Inspection DateExpiration DateInventory Qty 16 OCT 23
21103/31/202401/31/202598
31203/31/202401/31/202520
41303/31/202401/31/202540
51507/31/202405/31/202580
61612/31/202410/31/2025100
71701/31/202511/30/202520
81812/31/202412/31/202540
91407/31/202404/30/202660
102103/31/202401/31/202598
112203/31/202401/31/202520
122303/31/202401/31/202540
132507/31/202405/31/202580
142612/31/202410/31/2025100
152701/31/202511/30/202520
162812/31/202412/31/202540
172407/31/202404/30/202660
Invlevel


Sales Plan Data

onhandtest.xlsx
ABCDEFGHIJKLMNOP
1Date (Year)Date (Month)
220232024
3Selling MaterialJanFebMarAprMayJunJulAugSepOctNovDecJanFebMar
415060708090100110120130140150160170180190
52406080100120140160180200220240260280300320
6
7
Sls Plan



RawDataPT with Sales

onhandtest.xlsx
ABCDEFGHIJKLTUVWXYZ
3Sales Forecast
420232024
5EAN/UPCNovDecJanFebMarAprMayJun
615060708090100110120
7EAN/UPCExpiration DateSum of Inventory Qty2406080100120140160180
8101/31/2025158
9104/30/202660
10105/31/202580
11110/31/2025100
12111/30/202520
13112/31/202540
14201/31/2025158
15204/30/202660
16205/31/202580
17210/31/2025100
18211/30/202520
19212/31/202540
20
21
22
23Current ideaSales Forecast
2420232024
25EAN/UPCNovDecJanFebMarAprMayJunUnit Balance
261506070809010011012020232024
272406080100120140160180NovDecJanFebMarApr
28EAN/UPCExpiration DateSum of Inventory Qty
29101/31/2025158506048108480000
30104/30/20266052860606060608
31105/31/2025802258808058000
32110/31/202510022781001001007800
33111/30/2025201282020202080
34112/31/2025404040404040400
35201/31/2025158406058118580000
36204/30/20266025860606060580
37205/31/2025802258808058000
38210/31/202510042581001001005800
39211/30/202520202020202000
40212/31/202540404040404000
41
42
43
invlevelPT
Cell Formulas
RangeFormula
E6:L6E6=VLOOKUP($A8,'Sls Plan'!$A:$AE,E1,0)
E7:L7E7=VLOOKUP($D7,'Sls Plan'!$A$4:$Q$5,E1,0)
E26:L27E26=E6
U29:U40U29=$C29-E29
V29:Z40V29=U29-F29
 

Attachments

  • RawData.png
    RawData.png
    42.8 KB · Views: 14
  • FinalLook.PNG
    FinalLook.PNG
    29.5 KB · Views: 12
  • RawDataPT wSalesPlan.PNG
    RawDataPT wSalesPlan.PNG
    25.3 KB · Views: 14

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Thank you for the inquiry. Unfortunately, I was forced to make slight changes to the presentation in the "Current idea" section, as shown below the following formulas for Cells F29 & F36.
These were previously on Column E, but a helper column was needed - as well as a blank Row 35. Note the color for the headers on Row 28 were changed, to indicate it's not a Pivot Table.

Formula for Cell F29, to be Copied and Pasted on Cells F29 to M34:​
Excel Formula:
=IF($D29=1,MIN(SUMIFS($C$29:$C$41,$A$29:$A$41,$A29,$B$29:$B$41,$B29),F$26,$C29-SUM($E29:E29)),MIN($C29-SUM($E29:E29),F$26-SUM(F$28:F28)))
Formula for Cell F36, to be Copied and Pasted on Cells F36 to M41:​
Excel Formula:
=IF($D36=1,MIN(SUMIFS($C$29:$C$41,$A$29:$A$41,$A36,$B$29:$B$41,$B36),F$27,$C36-SUM($E36:E36)),MIN($C36-SUM($E36:E36),F$27-SUM(F34:F$35)))

1698179872899.png
 
Upvote 0
Hello. Thank you so much for your response. I am sorry for just now getting back to you. But this is very helpful thank you. Can I ask another question? I have multiple products(over 200). Is there a formula to create the rank in column D? I should be able to do that but drawing a blank. Thank you once again.
 
Upvote 0
The first set of formulas above in Column D were written as follows, =RANK($B29,$B$29:$B$34,1)
This should work with your 200+ product range, as long as the data is written in contiguous vertical cells. Good luck!
 
Upvote 0
The first set of formulas above in Column D were written as follows, =RANK($B29,$B$29:$B$34,1)
This should work with your 200+ product range, as long as the data is written in contiguous vertical cells. Good luck!
hello. thank you so much for the response. Is there a way to do the rank every time column A changes? It is not a static list and will change. So this formula would take some time to copy down each time i do that update. Thank you once again for your time.
 
Upvote 0
You're welcome. All that you need to do is change the Row numbers, i.e. $29 or $34, as needed.
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,117
Members
453,021
Latest member
Justyna P

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