+ Reply to Thread
Results 1 to 2 of 2

Regular deposits at regular weekly intervals

  1. #1
    Registered User
    Join Date
    05-27-2018
    Location
    Philippines
    MS-Off Ver
    Office 365
    Posts
    5

    Post Regular deposits at regular weekly intervals

    (Disregard the 'close' and 'Date + I' columns.) There's a date column that exncludes Saturdays and Sundays. And what I want to do is to input a deposit at regular x weekly intervals. This could be deposited weekly, biweekly, triweekly, every four weeks, etc. I tried a sort of manual VBA:

    Please Login or Register  to view this content.
    which deposits the amount at N2 every 5 cells (in this case, that's every week). And I just just replace the symbol ' with a null character since the formula in line 5 comes out as:
    A7+5*'N3'

    and the formula in line 7 comes out as:
    'N2'

    What I wanna happen is when I change the interval, I want all the excess deposits to disappear as well.

    - - - - -
    In the stocks column, I want to retrieve the previous data and add Deposit/close for that date. For example, I want the stocks at June 2, 2015 to have the formula ="I2+G5/B7".
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Regular deposits at regular weekly intervals

    The fact that you are showing data in the past, and wanting to place deposits at an arbitrary interval, and remove "excess" deposits when you change the interval, suggests to me that you are running some sort of simulation. If that is true, then you can do this with formulas rather than VBA. Fortunately you have already set up your data layout to be friendly for such a solution. I have updated your file to show you what I mean.

    I have assumed that you want your first deposit to occur on June 2, 2015, regardless of the interval. Then the formula determines the interval after that by counting whether the specified interval in weeks has passed:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    If a holiday falls on a Tuesday and a deposit would normally be due that day, this algorithm will skip that deposit. This can happen on July 4, Christmas, and New Year's.

    I would recommend that column I be labelled "Shares" instead of "Stocks" but I didn't change it.

    Also I can't make sense of the formula you described above for June 2, 2015. I think you want

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I don't think your code will be useful. However, in the interests of learning, the reason your VBA doesn't work is that you are mixing the R1C1 formula format with the A1 format. The correct way to write your code would be
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Copying data at regular intervals
    By Shreyans Nahata in forum Excel General
    Replies: 6
    Last Post: 01-07-2015, 06:22 AM
  2. [SOLVED] Inserting colons into text at regular intervals
    By daedelous00 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-19-2014, 12:49 PM
  3. Calculating quantiies from irregular intervals to regular intervals
    By abhi1421 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-15-2014, 06:34 AM
  4. Finding y values at regular x intervals
    By tomal in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-13-2012, 08:59 PM
  5. Formula with Range set at regular intervals
    By jayheron1988 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-23-2010, 11:03 PM
  6. Running Macro at regular intervals.
    By Chintu Raju in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-21-2008, 10:52 AM
  7. How to trigger a macro at regular intervals?
    By ÉH in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-06-2006, 05:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1