Thanks Thanks:  0
Likes Likes:  0
Needs Pictures Needs Pictures:  0
Picture(s) thanks Picture(s) thanks:  0
Page 1 of 3 123 LastLast
Results 1 to 15 of 31
  1. #1
    Join Date
    May 2010
    Location
    Lower Lakes SA
    Age
    58
    Posts
    2,557

    Default Division Spreadsheet - Excel anomaly (OT)

    I've been building a spreadsheet to calculate cumulative angle readings in degrees, minutes & seconds for any given number of divisions. The point being to allow division with only a rotary table. You would pull up the sheet for the number of divisions you want, print it out and tick off each reading as you go. Credit to Tiff for the idea (though it's kind of obvious). I'm thinking this might be useful to other people too and I'm happy to share it when it's done.

    (From here on it gets off topic, so look away now if you're not interested in spreadsheets I guess) I'm calculating the answer in decimal degrees and then using a formula I adapted from a taper table (don't know who to credit) to convert to DMS. It seems to be working very well, except for a weird anomaly. In certain cases I'm getting eg 120,-1,60. I should read 120,0,0. I believe the -1 is an error code thrown by the INT function when it tries to produce an integer from zero. The next column reads it as a literal -1 and calculates 60. What is weird though, is that the exact same numbers and the exact same formulae produce the correct output in most cases. I can't for the life of me see what's different. To further complicate things there's a slightly different error where you get a legitimate number of minutes, but still 60 in the seconds column.

    I'll attach what I've done so far (had to zip it to get around the size limit) and if there's any spreadsheet gurus who want to take a look, I've labeled the sheets with the anomaly with an A. In particular, see 33A, 39A, 50A, 100A. The number of cases is small enough that I could just manually edit those entries, but I find it irritating and intriguing and I want to know why.

    Also if anyone knows a way to automate propagation of tables I'm interested. So far I've manually pasted and edited 77 sheets. 50 to go and I'll call it done. Any numbers higher than 127 can be done as needed.

    If anyone feels this is too far off topic, say so and I'll take any replies by PM.

  2. # ADS
    Google Adsense Advertisement
    Join Date
    Always
    Location
    Advertising world
    Age
    2010
    Posts
    Many





     
  3. #2
    Dave J Guest

    Default

    I don't think it is off topic, and thanks for taking the time and effort Bryan.

    Dave

  4. #3
    Join Date
    Jun 2007
    Location
    North Of The Boarder
    Age
    68
    Posts
    16,794

    Default

    Bryan may I ask which version of Excel in the past some have had problems with calculations.

    I recall a very early version 97 I think in currency had a discrepancy which could put calc of $100 out by $5 an update was available, not many new about it.

  5. #4
    Join Date
    May 2010
    Location
    Lower Lakes SA
    Age
    58
    Posts
    2,557

    Default

    It says Excel X for Mac Service Release 1. This mac was current a couple of years ago. I see there's an update for Office 2011, but nothing's jumping out at me for earlier versions. That would be really annoying, if it's a bug in the app. Will have to do some googling. Thanks for that.

  6. #5
    Join Date
    Aug 2008
    Location
    Adelaide
    Age
    68
    Posts
    834

    Default

    Bryan

    I ran the sheet on my Mac using Office 2008 12.2.8 (current patch level for 2008 - I'm too mean to pay Bill Gates for the 2011 version for reasons which will become apparent in a sentence or 2) and got the same results as you.

    I then ran it against both Neo Office and Open Office and it runs properly with no errors. I'll look at the Excel code to see why it's failing later we I get time but in the meantime I recommend installing either Open Office (which runs on Mac and Window$) or Neo Office.

    Both are free, open source products and both will read and write Office files (word, excel etc) and in the case of the Mac platform they actually handle the macros and scripts better than Office does. Office 2008 is widely regarded as an orphan dog of a port within the Mac community.

    Without going into it in depth yet it would seem that the issue is the number of decimals involved and internal rounding.

    I have to do some stuff for the domestic goddess, will return to the issue later.

  7. #6
    Join Date
    Jun 2008
    Location
    Victoria, Australia
    Age
    74
    Posts
    6,132

    Default

    Hi Bryan,

    If you only want the integer part of a number, you might be better to use TRUNC() rather than INT().

    INT will round, (rather than truncate) which will cause the problem you are seeing.check the following comparison of the two functions.

    TRUNC(-1.1=-1 ------------------ INT(-1.1) = -2
    TRUNC(-0.1)=0 ------------------ INT(-0.1) = -1
    TRUNC(0.1) = 0 ------------------ INT(0.1) =1
    TRUNC(1.1)=1 ------------------ INT(1.1) = 1

    Regards
    Ray

    EDIT: I'm not sure that it's an error in Excel as such, there have been arguments raging for years about "floored division", just depends what method you choose..

  8. #7
    Join Date
    May 2010
    Location
    Lower Lakes SA
    Age
    58
    Posts
    2,557

    Default

    Thanks Gavin, Ray. Glad someone knows what they're doing! TRUNC solves the first problem, not the second. eg, 50,23,60 should be 50,24,0. See sheets 50A & 100A.

  9. #8
    Join Date
    Jun 2008
    Location
    Victoria, Australia
    Age
    74
    Posts
    6,132

    Default

    Hi Bryan,

    The division rounds down in the 15th decimal place ... try adding a tiny offset, like 1/100th of a second

    Like so, in your spreadsheet column "B" make the formula =$B$2*A3+1/360000

    The 1/360000 is 0.01 second.

    I notice you aren't using absolute cell references, if you use $B$2 instead of the relative reference B2, then you can just copy and paste the formula.

    Hope that helps,

    That looks like a very handy spreadsheet, nice work

    Regards
    Ray

  10. #9
    Join Date
    May 2010
    Location
    Lower Lakes SA
    Age
    58
    Posts
    2,557

    Default

    Hi Ray, thanks. Your suggestion does seem to fix the problem. Can't say I like a lot, but without anything better I'll take it. I'm still interested to see if Gavin has anything to add. I don't want to spend more time on it till I'm confident I won't have to redo my work.

    I did eventually find out about the fixed cell reference. I knew there had to be a way and I interrogated help until it squeaked. A lot of those sheets were pasted using $B$2. I know they were, cos I couldn't possibly have manually edited all those cells! Why they now don't show the $ is baffling.

  11. #10
    Join Date
    Jun 2008
    Location
    Victoria, Australia
    Age
    74
    Posts
    6,132

    Default

    Hi Bryan,

    A more elegant fix for the rounding problem would be to use the ROUND function,

    The minutes column formula would look like =TRUNC((ROUND(B8-C8,8)*60))

    Regards
    Ray

  12. #11
    Join Date
    Aug 2008
    Location
    Adelaide
    Age
    68
    Posts
    834

    Default

    Bryan

    The formula for Column C should be =TRUNC(Bn)
    The formula for Column D should be =TRUNC((Bn-Cn)*60)
    The formula for Column E should be =ROUND((((Bn-Cn)*50)-Dn)*60,0)

    where n is your row number. Attached is a sample page for your page 33A

    Attachment 157420

    and, as has been mentioned before, your references to B2 in Column B only should be to $B$2 so the rows can be copied without the reference being incremented by Excel.

    Rgds - Gavin
    Last edited by Gavin Newman; 2nd January 2011 at 09:40 PM. Reason: added sample spreadsheet page

  13. #12
    Join Date
    Jun 2008
    Location
    Victoria, Australia
    Age
    74
    Posts
    6,132

    Default

    Hi Gavin,

    Yes, I fell for that at first, check your formula for the minutes column (column D)

    I think you will find it rounds down. That's why you need to round before truncating.

    The test case is 50 steps, the 7th division, where the degrees = 50 and minutes should be 24...

    Regards
    Ray

  14. #13
    Join Date
    May 2010
    Location
    Lower Lakes SA
    Age
    58
    Posts
    2,557

    Default

    Gavin, I can't get it to work on sheet 100. What have I done wrong?

  15. #14
    Join Date
    Aug 2008
    Location
    Adelaide
    Age
    68
    Posts
    834

    Default

    Bryan

    Try using Ray's idea for the minutes column (rounding prior to truncation). I missed that boundary condition when testing on the 33 sheet.

    I'm not happy, as a programmer, having to arbitrarily round to 8 decimal places as per the suggestion as I worry that there might be another boundary condition we haven't found yet but for the moment if it works go that way.

    Rgds - Gavin

  16. #15
    Join Date
    May 2010
    Location
    Lower Lakes SA
    Age
    58
    Posts
    2,557

    Default

    Will do. Thanks heaps guys.

Page 1 of 3 123 LastLast

Similar Threads

  1. Coving spreadsheet
    By AlexS in forum WOODWORK - GENERAL
    Replies: 5
    Last Post: 18th February 2011, 08:07 PM
  2. Problem with Excel spreadsheet
    By KevinB in forum WOODWORK - GENERAL
    Replies: 2
    Last Post: 12th August 2010, 12:05 PM
  3. 24 division Spindle index
    By catndog in forum WOODTURNING - GENERAL
    Replies: 7
    Last Post: 15th February 2008, 06:36 AM
  4. Replies: 4
    Last Post: 31st December 2005, 10:08 PM

Tags for this Thread

Posting Permissions

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