Excel Formula to get values old to latest

nabeelahmed

Board Regular
Joined
Jun 19, 2020
Messages
76
Office Version
  1. 365
Platform
  1. Windows
Dear Friends, I am trying to do following where i need your help. Please help me to do below tasks

1- When I enter Customer number in sheet1 (Column"A") old PO number for the same customer with balance quantity from Sheet2(Column"B") should appear in Sheet1(Column"B)
2- When the quantity of old PO finished(Zero) then next PO number for the same customer id should should appear
3- I want PO balance for current PO in Sheet1(Column"B") once quantity issued as described in sheet1(Column"C")


1596868105433.png
1596868137120.png



Thanks & Regards,

Nabeel
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Can you post data using xl2bb addin. In that way we dont have to type all the data
 
Upvote 0
Can you post data using xl2bb addin. In that way we dont have to type all the data


Book1
ABCD
4Customer IDPO #Quantity IssuedPO Balance
5000-2019-50000317347251390.97
6000-2019-50000317347301360.97
7000-2018-50000282019-00034501950
8000-2018-50000282019-000341001850
9000-2018-50000282019-000341201730
10000-2018-5000030PO20-00363150
11000-2018-50000282019-000342001530
12000-2018-50000282019-000341001430
13000-2018-50000282019-00034501380
14000-2018-50000282019-00034301350
15000-2015-5000011UCF-Agreement25
16000-2018-50000282019-00034251325
Sheet1




Book1
ABCD
4Customer IDPO No.PO Quantity (MT)PO Balance
5000-2020-500004519200025500
6235-2019-1000235LEG-EMAL2018004-03/18400
7236-2019-1000236LEG2018011-03/18300
8000-2015-50000064500070136399
9000-2018-50000282019-000342000
10000-2015-5000007FPO-98729.46
11000-2020-5000047NCF-P00000024563034.23
12000-2015-5000017742006932877.55
13000-2020-500004353000061532254.47
14000-2015-5000011UCF-Agreement5000
15000-2018-500002687648.94
16000-2019-5000035IBN/7953/202020.78
17000-2018-5000030PO20-00363182.88
18000-2019-500003173471415.97
19000-2020-500004519200026400
20000-2020-500004519200027300
21235-2019-1000235LEG-EMAL2018004-03/18600
Sheet2
 
Upvote 0
Let say for CustomerId 000-2019-5000031 the PO Quantity is 1415.97 so what should happen if Say the Balance Quantity was 1410 and you have issued 20. Can this happen?????

And if this can happen what would you require as you have issued extra say 14.03 Qty
 
Upvote 0
Let say for CustomerId 000-2019-5000031 the PO Quantity is 1415.97 so what should happen if Say the Balance Quantity was 1410 and you have issued 20. Can this happen?????

And if this can happen what would you require as you have issued extra say 14.03 Qty

What i understood you want to ask
i- If we have Po balance 1410 and we will issue 20 out of 1410 then balance should be 1390
ii- if i will issue 14.03 extra than PO quantity 1415.97( That is why i want when i enter customer id then the Po with some quantity even 1 should appear in PO# field and once that particular PO quantity will be Zero then in the PO field nothing should be shown unless we will not add new PO No. with available quantity for the that customer.
 
Upvote 0
As per your profile you are using office 365 and have Filter option, so considering this

Balance Quantity.xlsx
ABCDEF
1Customer IDHelper ColumnPO #PO Order Quantity OpeningQuantity IssuedPO Balance
2000-2019-5000031000-2019-5000031734873481001000
3000-2019-5000031000-2019-50000317347734720020180
4000-2019-5000031000-2019-5000031734773471801800
5000-2019-5000031000-2019-50000317349734930010290
6000-2019-5000031000-2019-500003173497349290290
7000-2018-5000030000-2018-5000030   
8000-2018-5000028000-2018-50000282019-000342019-0003420002000
9000-2018-5000028000-2018-50000282019-000342019-0003420002000
10000-2018-5000028000-2018-50000282019-000342019-0003420002000
11000-2018-5000028000-2018-50000282019-000342019-0003420002000
12000-2015-5000011000-2015-5000011UCF-AgreementUCF-Agreement50005000
13000-2018-5000028000-2018-50000282019-000342019-0003420002000
Sheet1
Cell Formulas
RangeFormula
B2:B13B2=A2&C2
C2:C13C2=IFERROR(INDEX(FILTER(IF(A2=Sheet2!$A$2:$A$18,Sheet2!$B$2:$B$18),IF(A2=Sheet2!$A$2:$A$18,Sheet2!$B$2:$B$18)<>FALSE),AGGREGATE(15,6,((SUMIF(Sheet2!$E$2:$E$18,A2&FILTER(IF(A2=Sheet2!$A$2:$A$18,Sheet2!$B$2:$B$18),IF(A2=Sheet2!$A$2:$A$18,Sheet2!$B$2:$B$18)<>FALSE),Sheet2!$C$2:$C$18)-SUMIF($B$1:B1,A2&FILTER(IF(A2=Sheet2!$A$2:$A$18,Sheet2!$B$2:$B$18),IF(A2=Sheet2!$A$2:$A$18,Sheet2!$B$2:$B$18)<>FALSE),$E$1:E1))^0)*(ROW(Sheet2!$A$2:$A$18)-ROW(Sheet2!$A$2)+1),1)),"")
D2:D13D2=IFERROR(IFERROR(INDEX($F$1:F1,AGGREGATE(14,6,1/(1/(IF(A2&C2=$A$1:A1&$C$1:C1,ROW($A$1:A1)-ROW($A$1)+1))),1)),VLOOKUP(A2&C2,IF({1,0},Sheet2!$E$2:$E$18,Sheet2!$C$2:$C$18),2,0)),"")
F2:F13F2=IFERROR(D2-E2,"")


Balance Quantity.xlsx
ABCDE
1Customer IDPO No.PO Quantity (MT)PO BalanceHelper Column
2000-2020-500004519200025500000-2020-500004519200025
3235-2019-1000235LEG-EMAL2018004-03/18400235-2019-1000235LEG-EMAL2018004-03/18
4236-2019-1000236LEG2018011-03/18300236-2019-1000236LEG2018011-03/18
5000-2015-50000064500070136399000-2015-50000064500070136
6000-2018-50000282019-000342000000-2018-50000282019-00034
7000-2015-5000007FPO-98729.46000-2015-5000007FPO-987
8000-2020-5000047NCF-P00000024563034.23000-2020-5000047NCF-P0000002456
9000-2015-5000017742006932877.55000-2015-50000177420069
10000-2020-500004353000061532254.47000-2020-50000435300006153
11000-2015-5000011UCF-Agreement5000000-2015-5000011UCF-Agreement
12000-2018-500002687648.94000-2018-5000026876
13000-2019-5000035IBN/7953/202020.78000-2019-5000035IBN/7953/2020
14000-2019-50000317348100000-2019-50000317348
15000-2019-50000317347200000-2019-50000317347
16000-2019-50000317349300000-2019-50000317349
17000-2020-500004519200027300000-2020-500004519200027
18235-2019-1000235LEG-EMAL2018004-03/18600235-2019-1000235LEG-EMAL2018004-03/18
Sheet2
Cell Formulas
RangeFormula
E2:E18E2=A2&B2
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A16Cell ValueduplicatestextNO
A14Cell ValueduplicatestextNO
A1:A13,A15,A17:A1048576Cell ValueduplicatestextNO
 
Upvote 0
I have tried to create as per your requirement. There might be some issue, please point out to me, i will try to solve all those issues.

Also i have tried using Helper column. It might not be necessary to create the helper column but i am figuring out the menthod without helper. Mean while please check for further modification

Also i have noticed i issue that your balance Quantity cannot be negative. So you have to be careful with Issued Quantity. If issued Quantity exceeds PO Quantity it will show error. So I try correct the error.
 
Upvote 0
I have tried to create as per your requirement. There might be some issue, please point out to me, i will try to solve all those issues.

Also i have tried using Helper column. It might not be necessary to create the helper column but i am figuring out the menthod without helper. Mean while please check for further modification

Also i have noticed i issue that your balance Quantity cannot be negative. So you have to be careful with Issued Quantity. If issued Quantity exceeds PO Quantity it will show error. So I try correct the error.

Its looking perfect.. Let me use it on my original work sheet then will give you feed back...

Thank you very much for giving your valuable time ... :)
 
Upvote 0
Dear Punit, I tried the formulas in my sheet but there is error, not working properly. I have attached my sheets, can you please help me???


Delivery Note Register.xlsm
GHKADAPAQ
7PO #PO BalanceCustomer IDQty IssuedHelperPO Order qty Opening
819200025000-2020-500004550000-2020-50000451920002510000
9LEG-EMAL2018004-03/18235-2019-10002352.98235-2019-1000235LEG-EMAL2018004-03/180
10UCF-Agreement000-2015-500001175.55000-2015-5000011UCF-Agreement48.94
11UCF-Agreement000-2015-500001174.52000-2015-5000011UCF-Agreement0
1219200025000-2020-500004577.22000-2020-5000045192000250
1319200025000-2020-500004525.02000-2020-5000045192000250
1419200026000-2020-500004578.83000-2020-500004519200026 
1519200027000-2020-500004575.52000-2020-500004519200027 
1619200027000-2020-500004573.57000-2020-5000045192000270
17UCF-Agreement000-2015-500001175.64000-2015-5000011UCF-Agreement0
18UCF-Agreement000-2015-500001124.52000-2015-5000011UCF-Agreement0
DATA





 
Upvote 0

Forum statistics

Threads
1,214,621
Messages
6,120,563
Members
448,972
Latest member
Shantanu2024

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