Merge data for each range based on two words & dates

abdo meghari

Well-known Member
Joined
Aug 3, 2021
Messages
573
Office Version
  1. 2019
Hello
I have about four ranges , every range could contain 5000 rows .
the ranges will be in columns A:D and I want merging ranges based on duplicates dates and the same words for duplicates date
so the duplicate date & NOT PAID should merge alone . also the duplicate date & PAID should merge alone . the merging ranges will be based on column B,C
the result should be in columns F:I and should delete ranges(F:I) when run the macro every time before merging .

before

MERGE RANGES.xlsm
ABCD
1SR
2ITEMDATETYPETOTAL
312023/06/10NOT PAID7,720.00
422023/06/10NOT PAID2,000.00
532023/06/10PAID6,810.00
642023/06/10PAID4,000.00
752023/06/11NOT PAID7,000.00
8SUM27,530.00
9
10SVR
11ITEMDATETYPETOTAL
1212023/06/10NOT PAID5,720.00
1322023/06/10PAID14,040.00
1432023/06/11NOT PAID1,230.00
1542023/06/11NOT PAID12,000.00
1652023/06/12PAID14,000.00
1762023/06/12PAID1,000.00
18SUM47,990.00
19
20
21SDE
22ITEMDATETYPETOTAL
2312023/06/10PAID4,000.00
2422023/06/10PAID1,000.00
2532023/06/11PAID2,000.00
2642023/06/11NOT PAID2,200.00
2752023/06/12NOT PAID3,000.00
28SUM12,200.00
29
30
31FGR
32ITEMDATETYPETOTAL
3312023/06/10PAID1,200.00
3422023/06/10PAID1,300.00
3532023/06/11NOT PAID1,100.00
3642023/06/12NOT PAID2,200.00
3752023/06/12NOT PAID7,000.00
38SUM12,800.00
REPORT
Cell Formulas
RangeFormula
D8,D38,D28D8=SUM(D3:D7)
D18D18=SUM(D12:D17)


after
MERGE RANGES.xlsm
ABCDEFGHI
1SRSR
2ITEMDATETYPETOTALITEMDATENOT PAIDPAID
312023/06/10NOT PAID7,720.0012023/06/109,720.0010,810.00
422023/06/10NOT PAID2,000.0022023/06/1170000.00
532023/06/10PAID6,810.00SUM16,720.0010,810.00
642023/06/10PAID4,000.00
752023/06/11NOT PAID7,000.00SVR
8SUM27,530.00ITEMDATENOT PAIDPAID
912023/06/105,720.0014,040.00
10SVR22023/06/1113,230.000.00
11ITEMDATETYPETOTAL32023/06/120.0015,000.00
1212023/06/10NOT PAID5,720.00SUM18,950.0029,040.00
1322023/06/10PAID14,040.00
1432023/06/11NOT PAID1,230.00SDE
1542023/06/11NOT PAID12,000.00ITEMDATENOT PAIDPAID
1652023/06/12PAID14,000.0012023/06/100.005,000.00
1762023/06/12PAID1,000.0022023/06/110.002,000.00
18SUM47,990.0032023/06/112,200.000.00
1942023/06/123,000.000.00
20SUM5,200.007,000.00
21SDE
22ITEMDATETYPETOTALFGR
2312023/06/10PAID4,000.00ITEMDATENOT PAIDPAID
2422023/06/10PAID1,000.0012023/06/100.002,500.00
2532023/06/11PAID2,000.0022023/06/111,100.000.00
2642023/06/11NOT PAID2,200.0032023/06/129,200.000.00
2752023/06/12NOT PAID3,000.00SUM10,300.002,500.00
28SUM12,200.00
29
30
31FGR
32ITEMDATETYPETOTAL
3312023/06/10PAID1,200.00
3422023/06/10PAID1,300.00
3532023/06/11NOT PAID1,100.00
3642023/06/12NOT PAID2,200.00
3752023/06/12NOT PAID7,000.00
38SUM12,800.00
REPORT
Cell Formulas
RangeFormula
H5:I5H5=SUM(H3:H4)
D8,D38,D28D8=SUM(D3:D7)
H27:I27,H12:I12H12=SUM(H9:H11)
D18D18=SUM(D12:D17)
H20:I20H20=SUM(H16:H19)
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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