Merging duplicates items after words contains colon based on different price for the same ID

abdo meghari

Well-known Member
Joined
Aug 3, 2021
Messages
531
Office Version
  1. 2019
Hello,
I would merge quantity in column E for duplicates BRANDS in column D based on column C for each range contains colon for each name MOVEMENT word is existed after colon .
, but when merge QTY should be based on the same price in unit price in column F . so you will note some the same duplicates IDs contain different price , so don't merge QTY for the same duplicates IDs contain different price .
when merge data should brings column C:F from INVOICES sheet and insert TOTAL column and calculate as the formula is existed .
every time when run the macro should replace new data with old data, also should sort data for each range based on column C from small to big based on numbers . .
last thing I have many ranges contains words and suffix :
I realized error about my topic . should merge same ID based on same price, not different price.
I can't correct my topic, sorry about this mistake!!

split brands.xlsm
ABCDEFG
2MOVEMENT : PURCHASING
3DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
42024.01.021141284GC 1200R20 AZ0026 CHI80895.000242,560.000
51285GC 1200R20 AZ0183 CHI40925.000
61385GC 315/80R22.5 AT161 CHI20735.000
71287GC 315/80R22.5 AZ126 CHI20735.000
81294GC 315/80R22.5 AZ188 CHI20745.000
91241BS 1200R20 G580 JAP402,035.000
101227BS 215/70R15C R623 THI8425.000
111221BS 205/70R15C R623 THI12405.000
12DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
132024.01.091211287GC 315/80R22.5 AZ126 CHI14735.00010,290.000
14DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
152024.01.101251227BS 215/70R15C R623 THI2425.000850.000
16DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
172024.01.201481287GC 315/80R22.5 AZ126 CHI26735.00019,110.000
18DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
192024.01.201491221BS 205/70R15C R623 THI50405.000391,650.000
201227BS 215/70R15C R623 THI12425.000
211241BS 1200R20 G580 JAP1802,035.000
22DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
232024.03.302171285GC 1200R20 AZ0183 CHI101,225.00012,250.000
24DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
252024.04.092261227BS 215/70R15C R623 THI4544.0002,176.000
26DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
272024.04.142301285GC 1200R20 AZ0183 CHI401,205.00081,950.000
281284GC 1200R20 AZ0026 CHI301,125.000
29DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
302024.04.172361284GC 1200R20 AZ0026 CHI201,125.00046,600.000
311285GC 1200R20 AZ0183 CHI201,205.000
32MOVEMENT : SELLING
33DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
342024.01.245611306BS 750R16 R230 JAP10775.0007,750.000
35DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
362024.01.245621306BS 750R16 R230 JAP2780.0001,560.000
37DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
382024.01.245631306BS 750R16 R230 JAP2780.0003,100.000
391305BS 700R16 R230 JAP2770.000
40
41SUMMARY
42TOTAL PURCHASE807,436.000
43TOTAL SELLING12,410.000
INVOICES




result


split brands.xlsm
ABCDEF
2MOVEMENT : PURCHASING
3ITEMCODEBRANDQTYUNIT PRICETOTAL
411221BS 205/70R15C R623 THI62405.00025,110.000
521227BS 215/70R15C R623 THI22425.0009,350.000
631227BS 215/70R15C R623 THI4544.0002,176.000
741241BS 1200R20 G580 JAP2202,035.000447,700.000
851284GC 1200R20 AZ0026 CHI80895.00071,600.000
961284GC 1200R20 AZ0026 CHI501,125.00056,250.000
1071285GC 1200R20 AZ0183 CHI40925.00037,000.000
1181285GC 1200R20 AZ0183 CHI101,225.00012,250.000
1291285GC 1200R20 AZ0183 CHI601,205.00072,300.000
13101385GC 315/80R22.5 AT161 CHI20735.00014,700.000
14111294GC 315/80R22.5 AZ188 CHI20745.00014,900.000
15121287GC 315/80R22.5 AZ126 CHI60735.00044,100.000
16MOVEMENT : SELLING
17ITEMCODEBRANDQTYUNIT PRICETOTAL
1811305BS 700R16 R230 JAP2770.0001,540.000
1921306BS 750R16 R230 JAP10775.0007,750.000
2031306BS 750R16 R230 JAP4780.0003,120.000
21
22SUMMARY
23TOTAL PURCHASE807,436.000
24TOTAL SELLING12,410.000
RESULT
Cell Formulas
RangeFormula
F18:F20,F4:F15F4=D4*E4


I hope to don't make any mistake .
 
Last edited:

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hi peter again
I try implement for this data , but suddenly merge error as highlighted , what's the reason?!
KashfMabiatReport1 with code.xls
ABCDEFG
3DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
42024.07.2011351568MOTORMECH 150A L KOR21,000.0009,995.000
51586NOVA 200A L KOR21,500.000
61540VEGA 55A L KOR1400.000
71300XPRO 70A L KOR4540.000
81334XPRO 70A R KOR4540.000
91588BATTREY 30A CHI1275.000
10DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
112024.07.2211411590BOHANO 55A L JAP1370.000370.000
12DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
132024.07.2311461343KM 215/65R16 TA21 KOR5435.0003,575.000
141518KM 195/65R15 TA21 KOR4350.000
15DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
162024.07.279700000021335XPRO 150A L KOR21,000.0006,115.000
171496XPRO 100A L KOR واطية1625.000
181448DUNLOP 285/60R18 AT25 JAP11,110.000
191594APPLLO 265/65R17 INDIA4595.000
20DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
212024.07.289700000111471BS 1400R20 R180 JAP24,500.0009,000.000
22DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
232024.07.299700000171495XPRO 200A L KOR41,285.00044,780.000
241335XPRO 150A L KOR41,000.000
251595XPRO 100A R KOR10610.000
261341XPRO 100A L KOR10620.000
271334XPRO 70A R KOR15510.000
281300XPRO 70A L KOR10515.000
291338XPRO 60A L KOR15425.000
301337XPRO 55A L KOR10390.000
311596YOKOHAMA 7A MALAYSIA 1265.000
32DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
332024.08.019700000261598XPRO 80A L KPOR1570.000570.000
34DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
352024.08.279700002161620YOKOHAMA 205/65R16 ES32 JAP4455.00015,160.000
361624DUNLOP 265/70R18 AT23 JAP41,100.000
371621LASSA 4*4 235/70R16 A/T2 TR4575.000
381623LASSA 235/50R19 H/P2 TR4560.000
391567DUNLOP 285/65R17 JAP2950.000
401619VEGA 70A R KOR5500.000
41DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
422024.08.299700000221339XPRO 90A L KOR9605.0005,445.000
43DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
442024.08.319700002271598XPRO 80A L KPOR1570.000570.000
45DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
462024.08.319700002331626KM 285/75R16 MT51 VIT8835.0006,680.000
47DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
482024.09.029700002471338XPRO 60A L KOR2425.000850.000
49DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
502024.09.049700002721631KM 245/70R17 AT52 VIT4645.0002,580.000
51DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
522024.08.279700002161620YOKOHAMA 205/65R16 ES32 JAP4455.00015,160.000
531624DUNLOP 265/70R18 AT23 JAP41,100.000
541621LASSA 4*4 235/70R16 A/T2 TR4575.000
551623LASSA 235/50R19 H/P2 TR4560.000
561567DUNLOP 285/65R17 JAP2950.000
571619VEGA 70A R KOR5500.000
58DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
592024.08.299700000221339XPRO 90A L KOR9605.0005,445.000
60DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
612024.08.319700002271598XPRO 80A L KPOR1570.000570.000
62DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
632024.08.319700002331626KM 285/75R16 MT51 VIT8835.0006,680.000
64DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
652024.09.029700002471338XPRO 60A L KOR2425.000850.000
66DATEINVOICE NOCODEBRANDQTYUNIT PRICETOTAL
672024.09.049700002721631KM 245/70R17 AT52 VIT4645.0002,580.000
INVOICES



this is what I got
KashfMabiatReport1 with code.xls
ABCDEF
3ITEMCODEBRANDQTYUNIT PRICETOTAL
411300XPRO 70A L KOR4540.0002,160.000
521300XPRO 70A L KOR10515.0005,150.000
631334XPRO 70A R KOR4540.0002,160.000
741334XPRO 70A R KOR15510.0007,650.000
851335XPRO 150A L KOR241,000.00024,000.000
961337XPRO 55A L KOR10390.0003,900.000
1071338XPRO 60A L KOR1522425.000646,850.000
1181339XPRO 90A L KOR99605.00059,895.000
1291341XPRO 100A L KOR10620.0006,200.000
13101343KM 215/65R16 TA21 KOR5435.0002,175.000
14111448DUNLOP 285/60R18 AT25 JAP11,110.0001,110.000
15121471BS 1400R20 R180 JAP24,500.0009,000.000
16131495XPRO 200A L KOR41,285.0005,140.000
17141496XPRO 100A L KOR1625.000625.000
18151518KM 195/65R15 TA21 KOR4350.0001,400.000
19161540VEGA 55A L KOR1400.000400.000
20171567DUNLOP 285/65R17 JAP22950.00020,900.000
21181568MOTORMECH 150A L KOR21,000.0002,000.000
22191586NOVA 200A L KOR21,500.0003,000.000
23201588BATTREY 30A CHI1275.000275.000
24211590BOHANO 55A L JAP1370.000370.000
25221594APPLLO 265/65R17 INDIA4595.0002,380.000
26231595XPRO 100A R KOR10610.0006,100.000
27241596YOKOHAMA 7A MALAYSIA 1265.000265.000
28251598XPRO 80A L KPOR111570.00063,270.000
29261619VEGA 70A R KOR55500.00027,500.000
30271620YOKOHAMA 205/65R16 ES32 JAP44455.00020,020.000
31281621LASSA 4*4 235/70R16 A/T2 TR44575.00025,300.000
32291623LASSA 235/50R19 H/P2 TR44560.00024,640.000
33301624DUNLOP 265/70R18 AT23 JAP441,100.00048,400.000
34311626KM 285/75R16 MT51 VIT88835.00073,480.000
35321631KM 245/70R17 AT52 VIT44645.00028,380.000
RESULT
Cell Formulas
RangeFormula
F4:F35F4=D4*E4


seem adding numbers without sum for some brands !
 
Upvote 0
PQ editor will inform me the Mcode was written in a newer version.
I have never seen this before. You are on 2019 and I am on 365. My code should be compatible with your version. Is your source the same as in my Mcode.
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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