Ideas needed to automate a report

Trying2learnVBA

Board Regular
Joined
Aug 21, 2019
Messages
67
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hello,

I have a monthly report for loan advances - New and Maturing.
1.All new loans and maturities in the month have to be added to the report based on the funding date for New or Maturity date for Maturities.
2.Days without activity simply say no activity.

The issues I am facing - some days there are multiple transactions either two New advances or one of each or even more. In this case I need to insert rows with the same date.
The report has to include every single day in the month. I am attaching an example for this to make more sense.

But the main issue here is that a vlookup or index/match formula will not work because of new advances or maturities with the same date. The solution I need is to find a way to automatically add the dates in a month
from say 6/1/22 to 6/30/22 BUT keep in mind some dates occur more than once.

Example MiniSheet.xlsx
ABCDEFGH
1Advance NumberAdvance AmountTrade DateFunding DateMaturity DateInitial Interest RatePayment Frequency
236145017100,000,000.006/2/2022 0:006/2/202211-Jul-220.010560New
336145018100,000,000.006/2/2022 0:006/2/20225-Aug-220.011890
436145019100,000,000.006/2/2022 0:006/4/20221-Sep-220.013790
536145020100,000,000.006/3/2022 0:006/8/202226-Aug-220.013190
636145021100,000,000.006/3/2022 0:006/22/202227-Jul-220.011460
736145022200,000,000.006/6/2022 0:006/24/20222-Sep-220.0134490
83614502350,000,000.0024-Jun-226/24/202223-Jun-230.002717723/30/1900 0:00
936145024250,000,000.006/29/2022 0:006/29/202213-Jul-220.015530
1036145025200,000,000.006/30/2022 0:006/30/202218-Jul-220.015830
1136145026200,000,000.006/30/2022 0:006/30/202225-Jul-220.015830
1236145027200,000,000.004/8/2022 0:006/3/20226/4/20220.006160Mats
1336145028200,000,000.004/6/2022 0:006/6/20226/6/20220.005660
143614502950,000,000.0012/4/2020 0:006/8/20226/8/20220.0131490
153614503050,000,000.008/6/2021 0:006/8/20226/8/20220.020790
16
17
18
19End result should be
20
21DateAdvance#Beg BalNew AdvanceMaturities
226/1/2022Obtained from previous month
236/2/202236145017100,000,000.00
246/2/202236145018100,000,000.00
256/3/2022NO ACTIVITY
266/4/202236145019100,000,000.00
276/4/202236145027200,000,000.00
286/5/2022NO ACTIVITY
296/6/202236145028200,000,000.00
306/7/2022NO ACTIVITY
316/8/202236145020100,000,000.00
326/8/20223614502950,000,000.00
336/8/20223614503050,000,000.00
346/11/2022
356/12/2022
366/13/2022
376/14/2022
386/15/2022
Sheet1
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Update your Excel version here and in your profile. Solution shall depend on that.
 
Upvote 0
Update your Excel version here and in your profile. Solution shall depend on that.
Sanjay,
I have version 2202 for Microsoft 365. It should be current.

I've been researching vba to insert rows based on criteria but I am not sure how to create a criteria to insert rows if the dates are not consecutive.
 
Upvote 0
Check this - I'm still not sure that you wanted this solution

Few things to mention -
  • There can be some discrepancies as I was confused how you arrived at few figures in the sample result you wanted. Any such discrepancy can be worked upon provided you find solution is workable.
  • I have changed date to numbers to keep uniformity - date are written differently in your and my part of the world. So you can convert to your format and check.
  • I couldn't find a sustainable solution to incorporate dates where no transaction was done. So I used conditional formatting to identify that few dates are missing between the dates.
Book1.xlsx
ABCDEFGHIJKL
1Advance NumberAdvance AmountTrade DateFunding DateMaturity DateInitial Interest RatePayment Frequency
23614501710000000044,71444,71444,7530.010560New
33614501810000000044,71444,71444,7780.011890
43614501910000000044,71444,71644,8050.013790
53614502010000000044,71544,72044,7990.013190
63614502110000000044,71544,73444,7690.011460
73614502220000000044,71844,73644,8060.0134490
8361450235000000044,73644,73645,1000.0027177290
93614502425000000044,74144,74144,7550.015530
103614502520000000044,74244,74244,7600.015830
113614502620000000044,74244,74244,7670.015830
123614502720000000044,65944,71544,7160.006160Mats
133614502820000000044,65744,71844,7180.005660
14361450295000000044,16944,72044,7200.0131490
15361450305000000044,41444,72044,7200.020790
16
17
18
19End result should beMy Solution
20
21DateAdvance#Beg BalNew AdvanceMaturitiesDateAdvance#Beg BalNew AdvanceMaturitiesMaturity Date
221/6/22Obtained from previous month44,713
232/6/223614501710000000044,71436145017 100000000 
242/6/223614501810000000044,71436145018 100000000 
253/6/22NO ACTIVITY44,71536145027  20000000044,716
264/6/223614501910000000044,71636145019100000000  
274/6/223614502720000000044,71836145028  20000000044,718
285/6/22NO ACTIVITY44,72036145020100000000  
296/6/223614502820000000044,72036145029  5000000044,720
307/6/22NO ACTIVITY44,72036145030  5000000044,720
318/6/223614502010000000044,73436145021100000000  
328/6/22361450295000000044,73636145022200000000  
338/6/22361450305000000044,73636145023 50000000 
3411/6/2244,74136145024 250000000 
3512/6/2244,74236145025 200000000 
366/13/202244,74236145026 200000000 
376/14/2022
386/15/2022
Sheet1
Cell Formulas
RangeFormula
G23:G36G23=SORT(FILTER(D2:D15,(D2:D15>=$G$22)*(D2:D15<=EOMONTH($G$22,0))),1,1)
H23:H36H23=SORTBY(FILTER(A2:A15,(D2:D15>=$G$22)*(D2:D15<=EOMONTH($G$22,0))),D2:D15,1)
I23:I36I23=XLOOKUP(1,($D$2:$D$15=G23)*($A$2:$A$15=H23)*($C$2:$C$15<G23)*($E$2:$E$15>EOMONTH($G$22,0)),$B$2:$B$15,"")
J23:J36J23=XLOOKUP(1,($D$2:$D$15=G23)*($A$2:$A$15=H23)*($C$2:$C$15=G23),$B$2:$B$15,"")
K23:K36K23=XLOOKUP(1,($A$2:$A$15=H23)*($E$2:$E$15<=EOMONTH($G$22,0)),$B$2:$B$15,"")
L23:L36L23=XLOOKUP(1,($A$2:$A$15=H23)*($E$2:$E$15<=EOMONTH($G$22,0)),$E$2:$E$15,"")
Dynamic array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
G23:G36Expression=G23>G22+1textNO
 
Upvote 0

Forum statistics

Threads
1,215,746
Messages
6,126,647
Members
449,325
Latest member
Hardey6ix

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