Merging Duplicate values and deleting rows based on certain parameters.

JohnBecks

New Member
Joined
Aug 9, 2021
Messages
13
Office Version
  1. 2019
Platform
  1. Windows
Hi there,

I need to use VBA to change Table A to Table B based on the following rules:

If customers have positive values in Column I for 22 days or more, their rows in Columns A-D will be merged into four cells (e.g. Customer A & C).
If a customer has negative and positive values in Column I for 22 days or more, their rows in Columns A-D will be merged into four cells (e.g. Customer J).
If a customer has no positive values in Column I for 22 days or more, their entire row will be deleted (e.g. Customers B & E).
If a customer has a negative balance in Column D, their entire row will be deleted, regardless of the values in Column I (e.g. Customer G).
If a customer has only negative values in Column I for 22 days or more and no positive values in Column I, their entire row will be deleted (e.g. Customer H).

Appreciate all the help with this.

+22 Days (1).xlsx
ABCDEFGHIJK
1Table A:
2
3Customer Limit Terms Balance InvoiceDateDue onDays Value Matched Outstanding
4A-IMD300.00INSOP/0045490013/01/202013/01/2020221,696.591,433.57263.02
5A-IMD300.00INSOP/0045492113/01/202013/01/2020536.98-36.98
6B-IMD356.93ARD6/0005223510/10/202210/10/202210356.93-356.93
7C25,000.00IMD9,014.37RJNL2/0000272106/09/201806/09/20181685902.67-902.67
8C25,000.00IMD9,014.37RJNL2/0000271923/08/201823/08/201816991,640.76-1,640.76
9C25,000.00IMD9,014.37RJNL2/0000272206/09/201806/09/20181685146.30-146.30
10C25,000.00IMD9,014.37RJNL2/0000272306/09/201806/09/201816851,951.98-1,951.98
11C25,000.00IMD9,014.37RJNL2/0000272430/08/201830/08/201816921,612.05-1,612.05
12C25,000.00IMD9,014.37RJNL2/0000272623/08/201823/08/20181699455.75-455.75
13C25,000.00IMD9,014.37RJNL2/0000272530/08/201830/08/201816922,156.55-2,156.55
14C25,000.00IMD9,014.37RJNL2/0000272030/08/201830/08/20181692148.31-148.31
15D-IMD2,649.00RJNL2/0000264905/11/201805/11/201816253,006.992,569.42437.57
16D-IMD2,649.00RJNL2/0000265012/11/201812/11/201816182,211.43-2,211.43
17E-COD9,223.98INSOP/0152117912/04/202315/04/202338,871.952,960.275,911.68
18E-COD9,223.98INSOP/0152118512/04/202315/04/202333,312.30-3,312.30
19F-IMD30,649.26RJNL2/0000276014/06/201814/06/201817691,660.58-1,660.58
20F-IMD30,649.26RJNL2/0000276121/06/201821/06/20181762198.75-198.75
21F-IMD30,649.26RJNL2/0000276221/06/201821/06/20181762618.26-618.26
22F-IMD30,649.26RJNL2/0000275914/06/201814/06/20181769398.71-398.71
23F-IMD30,649.26RJNL2/0000276813/09/201813/09/201816781,534.71-1,534.71
24F-IMD30,649.26RJNL2/0000276716/08/201816/08/201817062,466.84-2,466.84
25F-IMD30,649.26RJNL2/0000275224/05/201824/05/201817902,096.37-2,096.37
26F-IMD30,649.26RJNL2/0000276609/08/201809/08/201817131,935.54-1,935.54
27F-IMD30,649.26RJNL2/0000275017/05/201817/05/201817971,897.63-1,897.63
28G - 30- 10,000.00CRDN00039888824/05/201824/05/20181790- 5,000.00
29G - 30- 10,000.00RJNL2/0000276909/08/201809/08/2018171315,000.00
30H10,000.001515,000.002PCRNR/0014113512/03/202312/03/202335- 2,500.00- -
31H10,000.001515,000.002PCRNR/0014143209/03/202314/03/202357,500.00- -
32I25,000.00IMD9,014.37RJNL2/0000272030/08/201830/08/20181692- 148.31-148.31
33J-IMD5,000.00RJNL2/0000264905/11/201805/11/20181625- 2,500.00-43349
34J-IMD5,000.00RJNL2/0000265012/11/201812/11/201816187,500.00-
35
36Table B:
37
38Customer Limit Terms Balance InvoiceDateDue onDays Value Matched Outstanding
39A-IMD300.00INSOP/0045490013/01/202013/01/2020221,696.591,433.57263.02
40INSOP/0045492113/01/202013/01/2020536.98-36.98
41C25,000.00IMD9,014.37RJNL2/0000272106/09/201806/09/20181685902.67-902.67
42RJNL2/0000271923/08/201823/08/201816991,640.76-1,640.76
43RJNL2/0000272206/09/201806/09/20181685146.30-146.30
44RJNL2/0000272306/09/201806/09/201816851,951.98-1,951.98
45RJNL2/0000272430/08/201830/08/201816921,612.05-1,612.05
46RJNL2/0000272623/08/201823/08/20181699455.75-455.75
47RJNL2/0000272530/08/201830/08/201816922,156.55-2,156.55
48RJNL2/0000272030/08/201830/08/20181692148.31-148.31
49D-IMD2,649.00RJNL2/0000264905/11/201805/11/201816253,006.992,569.42437.57
50RJNL2/0000265012/11/201812/11/201816182,211.43-2,211.43
51F-IMD30,649.26RJNL2/0000276014/06/201814/06/201817691,660.58-1,660.58
52RJNL2/0000276121/06/201821/06/20181762198.75-198.75
53RJNL2/0000276221/06/201821/06/20181762618.26-618.26
54RJNL2/0000275914/06/201814/06/20181769398.71-398.71
55RJNL2/0000276813/09/201813/09/201816781,534.71-1,534.71
56RJNL2/0000276716/08/201816/08/201817062,466.84-2,466.84
57RJNL2/0000275224/05/201824/05/201817902,096.37-2,096.37
58RJNL2/0000276609/08/201809/08/201817131,935.54-1,935.54
59RJNL2/0000275017/05/201817/05/201817971,897.63-1,897.63
60J-IMD5,000.00RJNL2/0000264905/11/201805/11/20181625- 2,500.00 - - 2,500.00
61RJNL2/0000265012/11/201812/11/201816187,500.00-7,500.00
Sheet9
Cell Formulas
RangeFormula
J33J33=-F7
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hi,

Was wondering if someone was able to take a look at the above?

Thanks
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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