Scheduled transactions by week number

Peter Underwood peterunderwood1 at gmail.com
Mon Apr 11 11:56:52 EDT 2011


The Excel formula I used for the 4th Wednesday of the month was:

=$H$1+CHOOSE(WEEKDAY($H$1),24,23,22,21,27,26,25)

where H1 was the first day of the month which appeared on each month sheet
and CHOOSE is based on Sunday being 1, Monday being 2 etc (WEEKDAY can be
set to start weeks on Sunday or Monday to provide for different accounting
usages).

Basically that translates into:

1. Take the date of the first day of the month.
2. Add a number of days chosen by taking the weekday of 1st month (Sunday =
1) based on the weekday you want from a list 1=24, 2=23, 3=22, 4=21, 5=27,
6=26, 7=25). So if I want 4th Wednesday and the first day of the month is
Wednesday which is the 4th day of the week, it chooses the 4th parameter
which is 21 or 3 weeks. The other parameters are obviously pointing to the 3
days before and after that Wednesday.

It can't be hard to insert something similar into the GnuCash code when
someone can find the time. Obviously it's slightly more complicated because
users will have different start of week days (Sunday or Monday), different
week-in-the-month (1st, 2nd, 3rd, 4th) and different days of the week 1-7 on
which their transactions take place but those are merely refinements
involving the order of those 7 numbers, 21 to 27 inclusive.

I hope this helps.

Peter

On Mon, Apr 11, 2011 at 4:28 AM, David Sumbler <david at aeolia.co.uk> wrote:

> On Sun, 2011-04-10 at 16:02 +0000, peterunderwood1 at gmail.com wrote:
> > As a further encouragement to make changes to include the simple
> > formula 1st/2nd etc Mon/Tue/Wed etc of the month, U.S. Social Security
> > payments are made using this method of payment date. I suggest this
> > means there may be very large numbers of users who would like this
> > feature rather than manual entries every month for the rest of their
> > lives :)
>
> There must be something about these Social Security payments!  The Class
> 2 NIC payments I mentioned are the British equivalent.  The payment is
> made on 2nd Friday of the month, and is £2.50 times the number of
> Sundays in the previous calendar month!
>
> That would be fairly easy to program in many scripting languages
> (Python, for instance), but whether GnuCash allows such sophistication I
> need others to tell me.
>
> David
>
>


More information about the gnucash-user mailing list