+ Reply to Thread
Results 1 to 8 of 8

Non-decimal arithmetic: old £ s d and a negative balance

  1. #1
    Registered User
    Join Date
    07-17-2011
    Location
    Oxford, Englnd
    MS-Off Ver
    Excel 2003
    Posts
    2

    Non-decimal arithmetic: old £ s d and a negative balance

    I'm entering details of English personal accounts from 17th & 18th centuries. I convert amounts into farthings (£1=960; 1s=48; 1d=4), and can add them up in farthings: I do this for credit and debit totals, and subtract debit from credit to get a balance which I then reconvert back to
    £sd.

    The procedure for reconversion (got from a friendly forum for Fmpro) is

    £=trunc farthings/960; and I store mod (farthings, 960) in a cell (let's say A57)
    s=trunc A57/48; and the mod (A57, 48) goes into A58
    d=trunc A58/4
    f = mod( A58, 4)

    That all works fine, except when debit is greater than credit: the person owes money.
    the trunc/mod procedure gives a negative figure for the ££, but the mod(farthings, 960) records as a positive. And the arithmetic for ss and dd appears to go haywire.

    So the question is: how can I get a negative balance to reconvert accurately?

    All help gratefully received.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Non-decimal arithmetic: old £ s d and a negative balance

    cant really guess but wrapping in ABS() will give + for any calculation
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Non-decimal arithmetic: old £ s d and a negative balance

    just a joke but do you know what does sun+moon+stars=?

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,036

    Re: Non-decimal arithmetic: old £ s d and a negative balance

    without testing formula on your example workbook, maybe this could work?

    =IF(D3<0, "-", "")&Your_formula(ABS(D3))
    Never use Merged Cells in Excel

  5. #5
    Valued Forum Contributor
    Join Date
    07-17-2005
    Location
    Abergavenny, Wales, UK
    MS-Off Ver
    XL2003, XL2007, XL2010, XL2013, XL2016
    Posts
    608

    Re: Non-decimal arithmetic: old £ s d and a negative balance

    Hi

    The following will work, by taking the abs of the difference before any trunc or mod calculations, then placing a + or - in the column in from of the figures.

    take a look at the attached file with one sheet showing all the columns with the formulae, and the other with those columns hidden.
    Attached Files Attached Files
    --
    Regards
    Roger Govier
    Microsoft Excel MVP

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Non-decimal arithmetic: old £ s d and a negative balance

    sun+moon+stars= 3 farthings....3 far-things

  7. #7
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: Non-decimal arithmetic: old £ s d and a negative balance

    ...mod(farthings, 960) * SIGN(farthings)...
    Ben Van Johnson

  8. #8
    Registered User
    Join Date
    07-17-2011
    Location
    Oxford, Englnd
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Non-decimal arithmetic: old £ s d and a negative balance

    I posted the query at 5.30pm and by 10.30 you generous people had given me 6 answers,
    two of which work brilliantly. Many thanks. jd

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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