populate & update invoice information across sheets based on invoice number

abdo meghari

Well-known Member
Joined
Aug 3, 2021
Messages
612
Office Version
  1. 2019
Hi
in INVOICE sheet I will write invoice number into G6 and should match with column D in SALES or PURCHASE sheet then should populate details in INVOICE sheet and when I try to change data then should update for the target sheet and invoice no .
INV.xlsb
ABCDEFGHIJ
1ITEMDATECLIENTINV.NOBRANDTYPEORIGINQTY PRICETOTAL
2110/06/2023CFGT100BSJ_23444BS 215/60R16ER30JAP4.00430.001,720.00
3SUM10/06/2023CFGT100BSJ_234441,720.00
4110/06/2023CFGT101BSJ_23445GO 1200R20AZ0026CHI2.00955.001,910.00
5SUM10/06/2023CFGT101BSJ_234451,910.00
6115/09/2023CFGT102BSJ_23446GO 1200R20AZ0026CHI2.00950.001,900.00
7215/09/2023CFGT102BSJ_23446GO 1200R21AZ0027CHI3.001,000.003,000.00
8SUM15/09/2023CFGT102BSJ_234464,900.00
9115/09/2023CFGT103BSJ_23447BS 1200R20G580JAP1.002,000.002,000.00
10215/09/2023CFGT103BSJ_23447BS 1200R20G580THI1.002,000.002,000.00
11315/09/2023CFGT103BSJ_23447BS 1200R20R187THI1.002,000.002,000.00
12SUM15/09/2023CFGT103BSJ_234476,000.00
SALES




INV.xlsb
ABCDEFGHIJ
1ITEMDATECLIENTINV.NOBRANDTYPEORIGINQTY PRICETOTAL
2115/06/2023PTTY-001BSTR_23448BS 750R16R230JAP4.00500.002,000.00
3215/06/2023PTTY-001BSTR_23448BS 700R16R230JAP2.00400.00800.00
4SUM15/06/2023PTTY-001BSTR_234482,800.00
5115/09/2023PTTY-002BSTR_23449GO 1200R20AZ0026CHI1.00920.00920.00
6215/09/2023PTTY-002BSTR_23449GO 1200R20AZ0083CHI2.001,000.002,000.00
7SUM15/09/2023PTTY-002BSTR_234492,920.00
8115/09/2023PTTY-003BSTR_23450BS 1200R20G580JAP1.001,800.001,800.00
9215/09/2023PTTY-003BSTR_23450BS 1200R20G580THI1.001,800.001,800.00
10315/09/2023PTTY-003BSTR_23450BS 1200R20R187THI1.001,800.001,800.00
11SUM15/09/2023PTTY-003BSTR_234505,400.00
PURCHASE






example : invoice no BSJ_23444 for SALES sheet when I write in G6 then will be
step1
INV.xlsb
ABCDEFG
3PR_00001DATE
4PR_00001
5INVOICE NO
6BSJ_23444
7CLIENT
8
9DEBTS
10
11
12TO :
13ADDRESS :
14PHONE :
15
16
17
18
19
20ITEMBRANDTYPEORIGINQTYUNIT PRICETOTAL
210.00
220.00
230.00
240.00
250.00
260.00
270.00
28sum0.00
INVOICE
Cell Formulas
RangeFormula
G21:G27G21=E21*F21
G28G28=SUM(G21:G27)
Cells with Data Validation
CellAllowCriteria
F8:G8List#N/A
B21:B26List#N/A
C21:C22ListAZ0026;AZ0183
D21ListKOR
D22:D25ListCHI
C23:C24ListATZ161;AZ126;AZ188
C25ListAZ166
C26ListH005;D687
D26ListJAP


RESULT

step 2
will populate data
INV.xlsb
ABCDEFG
3PR_00001DATE
4PR_000012023/06/10
5INVOICE NO
6BSJ_23444
7RECEIVED NAME
8CFGT100
9DEBTS
10
11
12TO :
13ADDRESS :
14PHONE :
15
16
17
18
19
20ITEMBRANDTYPEORIGINQTYUNIT PRICETOTAL
211BS 215/60R16ER30JAP4.00430.001,720.00
220.00
230.00
240.00
250.00
260.00
270.00
280.00
290.00
300.00
310.00
320.00
330.00
340.00
350.00
360.00
370.00
380.00
390.00
400.00
410.00
420.00
430.00
440.00
450.00
460.00
470.00
480.00
490.00
500.00
51sum1,720.00
INVOICE
Cell Formulas
RangeFormula
G21:G50G21=E21*F21
G51G51=SUM(G21:G50)
Cells with Data Validation
CellAllowCriteria
B33List#N/A
B22:B29List#N/A
D22:D25ListCHI
D26ListJAP
D27ListJAP;THI
D28ListCHI
C23:C24ListATZ161;AZ126;AZ188
C25ListAZ166
C26ListH005;D687
C27ListG580;R187
C28ListATZ161;AZ126;AZ188
F8List#N/A
G8ListCFGT100;VBGTY;NBHYT;VFGH;GHYT;GFRT;GHT5;ERWQ;
B21ListBS 1200R20;GO 1200R20;BS 1200R24;GO 1200R24;GD 13R22.5;BS 13R22.5;BS 1400R20 ;OZKA 16.0/70-20;OS 23.5R25;TR 23.5R25;23.5-25;28x9-15 ;MS 31-10.5R15;GD 31x10.5R15;BS 315/80R22.5;DT 315/80RR.5;NP 315/80RR.5;GO 315/80R22.5;TY35×12.5R17;BS 385/65R22.5;405/70-20;TQ 175/65R14;KM 185/65R14;MS 185/70R14;WL 185/70R14;TQ 195R14C;CF 195/65R15;TQ 195/65R15;KM 195/65R15;WL 195/65R15;BS 195/60R15;BS 225/55R16;LS 205R14;BS 205/70R15C;KM 205/70R15C;BS 205R16C;TQ 205/60R16 ;KM 205/60R15;OV 205/65R16;TQ 215/50R17;BS 215/55R17;WL 215/55R17;KM 215/55R17;KM 215/60R16;BS 215/60R16;KM 215/60R17;BS 215/70R15C;BS 215/70R16;KM 225/50R17;BS 225/60R18;BS 225/60R16;HL 225/60R16;YH 225/60R16;KM 225/65R17;BS 225/70R16;BS 225/70R17;KM 225/70R15C;KM 215/65R16;WL 215/65R15;FR 215/75R15;WL 215/75R15;KM 215/75R15;KM 225/55R17;ALFA 225/60R16 ;TY 225/45ZR19;BS 225/95R16C;KM 235/55R17 ;KM 235/55R18 ;KM 235/55R19 ;MS 235/55R19;KM 235/60R16 ;DK 235/60ZR16;KM 235/60R17 ;KM 235/60R18 ;KM 235/65R17 ;MS 235/55R17;MS 235/75R16;KM 235/75R15;BS 235/55R17 ;KM 245/45R18 ;KM 245/70R17 ;KM 245/60R18;KM 245/75R16 ;TY 245/75R16;PF 245/75R16;TY 255/40ZR19;BS 255/70R15C ;KM 265/75R16;MS 265/75R16;TQ 265/75R16C;SF 265/60R18;BS 265/60R18;DL 265/65R17;MS 265/65R17;KM 265/65R17;HL 265/70R16 ;DL 265/70R17;BS 265/70R18;CN 275/45R21;BS 275/55R20;BS 285/50R20;BS 285/60R18;DL 285/60R18;YH 285/60R18;CO 295/40R22.5;KB 215/70R15C;WS 285/70R19.5;TQ 265/70R16;CN 315/40R21;BS 650R16;BS 700R16;BS 750R16;DL 750R16;FU 265/75R16;DL285/50R20;DONG 14.9-24 ;VAR 60A;VAR 70A;VAR 100A;VAR 90A;AUTO 68A;AUTO 55A;AUTO 70A;AUTO 90A;AUTO 180A;AUTO 60A LOW;AUTO 60A;AUTO 91A;AUTO 155A;AUTO 100A;AS 70A;XPRO 70A;XPRO 45A;XPRO 60A;XPRO 100A;XPRO 150A;QS 150A;QS 70A;QS 35A;Q8 10W-40;LIQ 10W-40;AS 40A;MASTER 55A;CRYSTAL 45A;VEGA 55AH ;VEGA 70AH ;VEGA 150AH ;VEGA 66AH ;VEGA 74AH ;PROLITE 55A;PROLITE 180A
C21ListER30
D21ListJAP

step3 when I change data(I highlighted by yellow color changed data)
INV.xlsb
ABCDEFG
3PR_00001DATE
4PR_000012023/06/11
5INVOICE NO
6BSJ_23444
7RECEIVED NAME
8CFGT1001
9DEBTS
10
11
12TO :
13ADDRESS :
14PHONE :
15
16
17
18
19
20ITEMBRANDTYPEORIGINQTYUNIT PRICETOTAL
211KM 215/60R17PS71KOR2.00330.00660.00
222GO 1200R20AZ0026CHI1.00980.00980.00
230.00
240.00
250.00
260.00
270.00
280.00
290.00
300.00
310.00
320.00
330.00
340.00
350.00
360.00
370.00
380.00
390.00
400.00
410.00
420.00
430.00
440.00
450.00
460.00
470.00
480.00
490.00
500.00
51sum1,640.00
INVOICE
Cell Formulas
RangeFormula
G21:G50G21=E21*F21
G51G51=SUM(G21:G50)
Cells with Data Validation
CellAllowCriteria
B33List#N/A
B23:B29List#N/A
C28ListATZ161;AZ126;AZ188
D26ListJAP
D27ListJAP;THI
D28ListCHI
C23:C24ListATZ161;AZ126;AZ188
C25ListAZ166
B21:B22ListBS 1200R20;GO 1200R20;BS 1200R24;GO 1200R24;GD 13R22.5;BS 13R22.5;BS 1400R20 ;OZKA 16.0/70-20;OS 23.5R25;TR 23.5R25;23.5-25;28x9-15 ;MS 31-10.5R15;GD 31x10.5R15;BS 315/80R22.5;DT 315/80RR.5;NP 315/80RR.5;GO 315/80R22.5;TY35×12.5R17;BS 385/65R22.5;405/70-20;TQ 175/65R14;KM 185/65R14;MS 185/70R14;WL 185/70R14;TQ 195R14C;CF 195/65R15;TQ 195/65R15;KM 195/65R15;WL 195/65R15;BS 195/60R15;BS 225/55R16;LS 205R14;BS 205/70R15C;KM 205/70R15C;BS 205R16C;TQ 205/60R16 ;KM 205/60R15;OV 205/65R16;TQ 215/50R17;BS 215/55R17;WL 215/55R17;KM 215/55R17;KM 215/60R16;BS 215/60R16;KM 215/60R17;BS 215/70R15C;BS 215/70R16;KM 225/50R17;BS 225/60R18;BS 225/60R16;HL 225/60R16;YH 225/60R16;KM 225/65R17;BS 225/70R16;BS 225/70R17;KM 225/70R15C;KM 215/65R16;WL 215/65R15;FR 215/75R15;WL 215/75R15;KM 215/75R15;KM 225/55R17;ALFA 225/60R16 ;TY 225/45ZR19;BS 225/95R16C;KM 235/55R17 ;KM 235/55R18 ;KM 235/55R19 ;MS 235/55R19;KM 235/60R16 ;DK 235/60ZR16;KM 235/60R17 ;KM 235/60R18 ;KM 235/65R17 ;MS 235/55R17;MS 235/75R16;KM 235/75R15;BS 235/55R17 ;KM 245/45R18 ;KM 245/70R17 ;KM 245/60R18;KM 245/75R16 ;TY 245/75R16;PF 245/75R16;TY 255/40ZR19;BS 255/70R15C ;KM 265/75R16;MS 265/75R16;TQ 265/75R16C;SF 265/60R18;BS 265/60R18;DL 265/65R17;MS 265/65R17;KM 265/65R17;HL 265/70R16 ;DL 265/70R17;BS 265/70R18;CN 275/45R21;BS 275/55R20;BS 285/50R20;BS 285/60R18;DL 285/60R18;YH 285/60R18;CO 295/40R22.5;KB 215/70R15C;WS 285/70R19.5;TQ 265/70R16;CN 315/40R21;BS 650R16;BS 700R16;BS 750R16;DL 750R16;FU 265/75R16;DL285/50R20;DONG 14.9-24 ;VAR 60A;VAR 70A;VAR 100A;VAR 90A;AUTO 68A;AUTO 55A;AUTO 70A;AUTO 90A;AUTO 180A;AUTO 60A LOW;AUTO 60A;AUTO 91A;AUTO 155A;AUTO 100A;AS 70A;XPRO 70A;XPRO 45A;XPRO 60A;XPRO 100A;XPRO 150A;QS 150A;QS 70A;QS 35A;Q8 10W-40;LIQ 10W-40;AS 40A;MASTER 55A;CRYSTAL 45A;VEGA 55AH ;VEGA 70AH ;VEGA 150AH ;VEGA 66AH ;VEGA 74AH ;PROLITE 55A;PROLITE 180A
C21ListPS71
D21ListKOR
C22ListAZ0026;AZ0183
D22:D25ListCHI
F8List#N/A
G8ListCFGT1001;VBGTY;NBHYT;VFGH;GHYT;GFRT;GHT5;ERWQ;


should change in SALES sheet for highlighted yellow cells.


INV.xlsb
ABCDEFGHIJ
1ITEMDATECLIENTINV.NOBRANDTYPEORIGINQTY PRICETOTAL
2111/06/2023CFGT1001BSJ_23444KM 215/60R17PS71KOR2.00330.00660.00
3211/06/2023CFGT1001BSJ_23444GO 1200R20AZ0026CHI1.00980.00980.00
4SUM11/06/2023CFGT1001BSJ_234441,640.00
SALES

as you see when change data in invoice sheet I add new item then should insert row for new item before sum row .

another example

when write BSJ_23447 in G6 then should populate data

INV.xlsb
ABCDEFG
3PR_00001DATE
4PR_000012023/09/15
5INVOICE NO
6BSJ_23447
7RECEIVED NAME
8CFGT103
9DEBTS
10
11
12TO :
13ADDRESS :
14PHONE :
15
16
17
18
19
20ITEMBRANDTYPEORIGINQTYUNIT PRICETOTAL
211BS 1200R20G580JAP1.002,000.002,000.00
222BS 1200R20G580THI1.002,000.002,000.00
233BS 1200R20R187JAP1.002,000.002,000.00
240.00
250.00
260.00
270.00
280.00
290.00
300.00
310.00
320.00
330.00
34sum6,000.00
INVOICE
Cell Formulas
RangeFormula
G21:G33G21=E21*F21
G34G34=SUM(G21:G33)
Cells with Data Validation
CellAllowCriteria
B33List#N/A
B24:B29List#N/A
D28ListCHI
D24:D25ListCHI
B21:B23ListBS 1200R20;GO 1200R20;BS 1200R24;GO 1200R24;GD 13R22.5;BS 13R22.5;BS 1400R20 ;OZKA 16.0/70-20;OS 23.5R25;TR 23.5R25;23.5-25;28x9-15 ;MS 31-10.5R15;GD 31x10.5R15;BS 315/80R22.5;DT 315/80RR.5;NP 315/80RR.5;GO 315/80R22.5;TY35×12.5R17;BS 385/65R22.5;405/70-20;TQ 175/65R14;KM 185/65R14;MS 185/70R14;WL 185/70R14;TQ 195R14C;CF 195/65R15;TQ 195/65R15;KM 195/65R15;WL 195/65R15;BS 195/60R15;BS 225/55R16;LS 205R14;BS 205/70R15C;KM 205/70R15C;BS 205R16C;TQ 205/60R16 ;KM 205/60R15;OV 205/65R16;TQ 215/50R17;BS 215/55R17;WL 215/55R17;KM 215/55R17;KM 215/60R16;BS 215/60R16;KM 215/60R17;BS 215/70R15C;BS 215/70R16;KM 225/50R17;BS 225/60R18;BS 225/60R16;HL 225/60R16;YH 225/60R16;KM 225/65R17;BS 225/70R16;BS 225/70R17;KM 225/70R15C;KM 215/65R16;WL 215/65R15;FR 215/75R15;WL 215/75R15;KM 215/75R15;KM 225/55R17;ALFA 225/60R16 ;TY 225/45ZR19;BS 225/95R16C;KM 235/55R17 ;KM 235/55R18 ;KM 235/55R19 ;MS 235/55R19;KM 235/60R16 ;DK 235/60ZR16;KM 235/60R17 ;KM 235/60R18 ;KM 235/65R17 ;MS 235/55R17;MS 235/75R16;KM 235/75R15;BS 235/55R17 ;KM 245/45R18 ;KM 245/70R17 ;KM 245/60R18;KM 245/75R16 ;TY 245/75R16;PF 245/75R16;TY 255/40ZR19;BS 255/70R15C ;KM 265/75R16;MS 265/75R16;TQ 265/75R16C;SF 265/60R18;BS 265/60R18;DL 265/65R17;MS 265/65R17;KM 265/65R17;HL 265/70R16 ;DL 265/70R17;BS 265/70R18;CN 275/45R21;BS 275/55R20;BS 285/50R20;BS 285/60R18;DL 285/60R18;YH 285/60R18;CO 295/40R22.5;KB 215/70R15C;WS 285/70R19.5;TQ 265/70R16;CN 315/40R21;BS 650R16;BS 700R16;BS 750R16;DL 750R16;FU 265/75R16;DL285/50R20;DONG 14.9-24 ;VAR 60A;VAR 70A;VAR 100A;VAR 90A;AUTO 68A;AUTO 55A;AUTO 70A;AUTO 90A;AUTO 180A;AUTO 60A LOW;AUTO 60A;AUTO 91A;AUTO 155A;AUTO 100A;AS 70A;XPRO 70A;XPRO 45A;XPRO 60A;XPRO 100A;XPRO 150A;QS 150A;QS 70A;QS 35A;Q8 10W-40;LIQ 10W-40;AS 40A;MASTER 55A;CRYSTAL 45A;VEGA 55AH ;VEGA 70AH ;VEGA 150AH ;VEGA 66AH ;VEGA 74AH ;PROLITE 55A;PROLITE 180A
C21:C23ListG580;R187
D21:D22ListJAP;THI
D23ListJAP
C25ListAZ166
F8List#N/A
G8ListCFGT1001;CFGT103;NBHYT;VFGH;GHYT;GFRT;GHT5;ERWQ;


when I change data as highlighted cells with delete item then will be
INV.xlsb
ABCDEFG
3PR_00001DATE
4PR_000012023/09/16
5INVOICE NO
6BSJ_234471
7RECEIVED NAME
8CFGT1031
9DEBTS
10
11
12TO :
13ADDRESS :
14PHONE :
15
16
17
18
19
20ITEMBRANDTYPEORIGINQTYUNIT PRICETOTAL
211BS 1200R20G580JAP10.002,000.0020,000.00
222BS 1200R20G580THI1.002,000.002,000.00
230.00
240.00
250.00
260.00
270.00
280.00
290.00
300.00
310.00
320.00
33sum22,000.00
INVOICE
Cell Formulas
RangeFormula
G21:G32G21=E21*F21
G33G33=SUM(G21:G32)
Cells with Data Validation
CellAllowCriteria
B32List#N/A
B23:B28List#N/A
D27ListCHI
D23:D24ListCHI
B21:B22ListBS 1200R20;GO 1200R20;BS 1200R24;GO 1200R24;GD 13R22.5;BS 13R22.5;BS 1400R20 ;OZKA 16.0/70-20;OS 23.5R25;TR 23.5R25;23.5-25;28x9-15 ;MS 31-10.5R15;GD 31x10.5R15;BS 315/80R22.5;DT 315/80RR.5;NP 315/80RR.5;GO 315/80R22.5;TY35×12.5R17;BS 385/65R22.5;405/70-20;TQ 175/65R14;KM 185/65R14;MS 185/70R14;WL 185/70R14;TQ 195R14C;CF 195/65R15;TQ 195/65R15;KM 195/65R15;WL 195/65R15;BS 195/60R15;BS 225/55R16;LS 205R14;BS 205/70R15C;KM 205/70R15C;BS 205R16C;TQ 205/60R16 ;KM 205/60R15;OV 205/65R16;TQ 215/50R17;BS 215/55R17;WL 215/55R17;KM 215/55R17;KM 215/60R16;BS 215/60R16;KM 215/60R17;BS 215/70R15C;BS 215/70R16;KM 225/50R17;BS 225/60R18;BS 225/60R16;HL 225/60R16;YH 225/60R16;KM 225/65R17;BS 225/70R16;BS 225/70R17;KM 225/70R15C;KM 215/65R16;WL 215/65R15;FR 215/75R15;WL 215/75R15;KM 215/75R15;KM 225/55R17;ALFA 225/60R16 ;TY 225/45ZR19;BS 225/95R16C;KM 235/55R17 ;KM 235/55R18 ;KM 235/55R19 ;MS 235/55R19;KM 235/60R16 ;DK 235/60ZR16;KM 235/60R17 ;KM 235/60R18 ;KM 235/65R17 ;MS 235/55R17;MS 235/75R16;KM 235/75R15;BS 235/55R17 ;KM 245/45R18 ;KM 245/70R17 ;KM 245/60R18;KM 245/75R16 ;TY 245/75R16;PF 245/75R16;TY 255/40ZR19;BS 255/70R15C ;KM 265/75R16;MS 265/75R16;TQ 265/75R16C;SF 265/60R18;BS 265/60R18;DL 265/65R17;MS 265/65R17;KM 265/65R17;HL 265/70R16 ;DL 265/70R17;BS 265/70R18;CN 275/45R21;BS 275/55R20;BS 285/50R20;BS 285/60R18;DL 285/60R18;YH 285/60R18;CO 295/40R22.5;KB 215/70R15C;WS 285/70R19.5;TQ 265/70R16;CN 315/40R21;BS 650R16;BS 700R16;BS 750R16;DL 750R16;FU 265/75R16;DL285/50R20;DONG 14.9-24 ;VAR 60A;VAR 70A;VAR 100A;VAR 90A;AUTO 68A;AUTO 55A;AUTO 70A;AUTO 90A;AUTO 180A;AUTO 60A LOW;AUTO 60A;AUTO 91A;AUTO 155A;AUTO 100A;AS 70A;XPRO 70A;XPRO 45A;XPRO 60A;XPRO 100A;XPRO 150A;QS 150A;QS 70A;QS 35A;Q8 10W-40;LIQ 10W-40;AS 40A;MASTER 55A;CRYSTAL 45A;VEGA 55AH ;VEGA 70AH ;VEGA 150AH ;VEGA 66AH ;VEGA 74AH ;PROLITE 55A;PROLITE 180A
C21:C22ListG580;R187
D21:D22ListJAP;THI
C24ListAZ166
F8List#N/A
G8ListCFGT1001;CFGT1031;NBHYT;VFGH;GHYT;GFRT;GHT5;ERWQ;


and when change data in SALES invoice will be
INV.xlsb
ABCDEFGHIJ
10116/09/2023CFGT1031BSJ_234471BS 1200R20G580JAP10.002,000.0020,000.00
11216/09/2023CFGT1031BSJ_234471BS 1200R20G580THI1.002,000.002,000.00
12SUM16/09/2023CFGT1031BSJ_23447122,000.00
SALES

as you see will delete the item from sales sheet based on change INVOICE sheet
and when change date, invoice number and client then will repeat until sum row
after that I will delete clearcontents cells except cells contains formulas
thanks
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

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