Q: Formula for Aging

Joeun

New Member
Joined
Sep 10, 2017
Messages
20
Office Version
  1. 2016
Platform
  1. Windows
Hi Guys,

I need help for completing my formula on cell M3:M9 by filling in the Aging days. The data will take from identify the "lot number" on cell I3:I9, search value on my stock table and return with the latest incoming date.

Thanks for any suggestions.

Stock.xlsx
ABCDEFGHIJKLMNOPQ
1DATELOT NO.IN KGOUT KGBALANCE
2DATELOT NO.IN KGOUT KGBALANCELot NoInOutBalanceAgingLast Incoming DateAging (day)
326/03/2018S0165W23,529.0023,529.0018S0165W85395.7182953.71244214/05/23115
430/03/2018S0165W1,650.0021,879.0018S0218W164671584362408/03/21912
503/04/2018S0165W3,300.0018,579.0018S0282W16929169072205/06/21823
607/04/2018S0165W3,300.0015,279.0018S0300W25794.4825260.4853422/05/23107
709/04/2018S0165W3,300.0011,979.00 000
815/04/2018S0165W3,300.008,679.00 000
930/04/2018S0165W23,529.0032,208.00 000
1027/05/2018S0165W3,300.0028,908.00
1105/06/2018S0165W1,980.0026,928.00
1209/06/2018S0165W726.0026,202.00
1311/06/2018S0165W1,320.0024,882.00
1427/07/2018S0165W1,377.5626,259.56
1511/08/2018S0165W816.5625,443.00
1625/08/2018S0165W660.0024,783.00
1707/09/2018S0165W2,244.0022,539.00
1824/09/2018S0165W1,980.0020,559.00
1902/10/2018S0165W1,089.0019,470.00
2005/10/2018S0165W1,320.0018,150.00
2119/10/2018S0165W858.0017,292.00
2211/11/2018S0165W693.0016,599.00
2324/11/2018S0165W660.0015,939.00
2408/12/2018S0165W1,320.0014,619.00
2515/12/2018S0165W4,620.009,999.00
2605/01/2118S0165W6,600.003,399.00
2704/02/2118S0165W3,399.00-
2808/03/2118S0218W16,467.0016,467.00
2908/03/2118S0218W1,980.0014,487.00
3010/03/2118S0218W528.0013,959.00
3111/03/2118S0218W726.0013,233.00
3201/04/2118S0218W1,320.0011,913.00
3307/04/2118S0218W1,386.0010,527.00
3406/04/2118S0218W660.009,867.00
3513/04/2118S0218W1,188.008,679.00
3615/04/2118S0218W1,320.007,359.00
3716/04/2118S0218W1,320.006,039.00
3821/04/2118S0218W660.005,379.00
3922/04/2118S0218W726.004,653.00
4005/06/2118S0282W16,929.0016,929.00
4115/07/2118S0218W2,970.001,683.00
4221/07/2118S0218W396.001,287.00
4324/07/2118S0218W363.00924.00
4430/07/2118S0218W300.00624.00
4530/07/2118S0282W396.0016,533.00
4623/08/2118S0282W1,980.0014,553.00
4722/09/2118S0282W2,112.0012,441.00
4824/09/2118S0282W1,584.0010,857.00
4918/10/2118S0282W528.0010,329.00
5019/10/2118S0282W792.009,537.00
5120/10/2118S0282W1,848.007,689.00
5227/10/2118S0282W1,056.006,633.00
5301/11/2118S0282W6,303.00330.00
5425/11/2118S0165W5,907.005,907.00
5529/11/2118S0165W1,452.004,455.00
5629/11/2118S0282W297.0033.00
5729/11/2118S0165W3,300.001,155.00
5830/11/2118S0282W11.0022.00
5906/12/2118S0165W1,155.00-
6020/12/2118S0165W37.3037.30
6124/12/2118S0300W23,529.0023,529.00
6229/12/2118S0300W3,300.0020,229.00
6331/12/2118S0300W891.0019,338.00
6404/01/2218S0300W6,600.0012,738.00
6518/01/2218S0300W15.4812,753.48
6624/01/2218S0300W3,300.009,453.48
6711/02/2218S0300W1,980.007,473.48
6811/02/2218S0165W23,529.0023,566.30
6916/02/2218S0300W1,056.006,417.48
7023/02/2218S0300W660.005,757.48
7124/02/2218S0300W528.005,229.48
7201/07/2218S0300W33.005,196.48
7304/07/2218S0300W5,148.0048.48
7403/08/2218S0165W2,244.0021,322.30
7508/08/2218S0165W2,508.0018,814.30
7624/08/2218S0165W726.0018,088.30
7703/09/2218S0165W1,980.0016,108.30
7807/09/2218S0165W5,016.0011,092.30
7907/09/2218S0165W165.0010,927.30
8012/09/2218S0165W7,491.003,436.30
8114/09/2218S0165W2,145.001,291.30
8211/10/2218S0165W1,254.0037.30
8328/10/2218S0165W226.85264.15
8419/04/2318S0165W264.15- 0.00
8519/04/2318S0300W8.4840.00
8614/05/2318S0165W7,260.007,260.00
8722/05/2318S0300W2,250.002,290.00
8818/06/2318S0300W1,756.00534.00
8906/07/2318S0165W1,419.005,841.00
9007/07/2318S0165W2,013.003,828.00
9115/08/2318S0165W792.003,036.00
9221/08/2318S0165W594.002,442.00
Sheet3
Cell Formulas
RangeFormula
I3:I9I3=IF(SUMIF($B$3:$B$107,INDEX(B3:B107,MATCH(0,INDEX(COUNTIF($I$2:I2,B3:B107),),0)),$C$3:$C$107)-SUMIF($B$3:$B$107,INDEX(B3:B107,MATCH(0,INDEX(COUNTIF($I$2:I2,B3:B107),),0)),$D$3:$D$107)>0,INDEX(B3:B107,MATCH(0,INDEX(COUNTIF($I$2:I2,B3:B107),),0)),"")
J3:J9J3=SUMIF($B$3:$B$107,I3,$C$3:$C$107)
K3:K9K3=SUMIF($B$3:$B$107,I3,$D$3:$D$107)
L3:L9L3=J3-K3
P3:P6P3=TODAY()-O3
E90:E92,E3:E88E3=IFNA(LOOKUP(2,1/($B$1:B2=B3),$E$1:E2),0)+C3-D3
E89E89=IFNA(LOOKUP(2,1/($B$1:B86=B89),$E$1:E86),0)+C89-D89
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
I am not sure if you have the MAXIFS function available. If yes, you could try the following formula in cell M3:

Excel Formula:
=TODAY()-MAXIFS($A$3:$A$92,$B$3:$B$92,I3,$C$3:$C$92,">0")

Hope that helps,

Doug
 
Upvote 0
Joy, so it will probably require a combination of IF and MAX functions, an array formula with Ctrl-Shift-Enter. Right Fluff? I always struggled writing those...LOL.
 
Upvote 0
Hi Joeun,

A quick search for "excel maxifs equivalent" yielded results that showed how to write it with a MAX and IF combined function or using the AGGREGATE function.

Give one or both of those methods a shot.

Doug
 
Upvote 0
Is anyone might be able to help with 😄
Appreciate it!
 
Upvote 0
Is this it? (formulas in O3:O5)
Book1
ABCDEFGHIJKLMNOP
1DATELOT NO.IN KGOUT KGBALANCE
2DATELOT NO.IN KGOUT KGBALANCELot NoInOutBalanceAgingLast Incoming DateAging (day)
326/03/202018S0165W235292352918S0165W85395.7182953.71244214/05/2023117
430/03/202018S0165W16502187918S0218W16467158436248/03/2021914
53/04/202018S0165W33001857918S0282W1692916907225/06/2021825
67/04/202018S0165W33001527918S0300W25794.4825260.4853422/05/2023109
79/04/202018S0165W330011979 000
815/04/202018S0165W33008679 000
930/04/202018S0165W2352932208 000
1027/05/202018S0165W330028908
115/06/202018S0165W198026928
129/06/202018S0165W72626202
1311/06/202018S0165W132024882
1427/07/202018S0165W1377.5626259.56
Sheet1
Cell Formulas
RangeFormula
I3:I9I3=IF(SUMIF($B$3:$B$107,INDEX(B3:B107,MATCH(0,INDEX(COUNTIF($I$2:I2,B3:B107),),0)),$C$3:$C$107)-SUMIF($B$3:$B$107,INDEX(B3:B107,MATCH(0,INDEX(COUNTIF($I$2:I2,B3:B107),),0)),$D$3:$D$107)>0,INDEX(B3:B107,MATCH(0,INDEX(COUNTIF($I$2:I2,B3:B107),),0)),"")
J3:J9J3=SUMIF($B$3:$B$107,I3,$C$3:$C$107)
K3:K9K3=SUMIF($B$3:$B$107,I3,$D$3:$D$107)
L3:L9L3=J3-K3
O3:O6O3=AGGREGATE(14,6,$A:$A/(($B:$B=I3)*($C:$C>0)),1)
P3:P6P3=TODAY()-O3
E3:E14E3=IFNA(LOOKUP(2,1/($B$1:B2=B3),$E$1:E2),0)+C3-D3
Named Ranges
NameRefers ToCells
_FilterDatabase=Sheet1!$A$2:$E$92O3:O6
 
Upvote 1
Solution

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

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