+ Reply to Thread
Results 1 to 3 of 3

Simple If-Then test giving unexpected results

  1. #1
    Registered User
    Join Date
    05-17-2014
    MS-Off Ver
    Excel 2003
    Posts
    7

    Simple If-Then test giving unexpected results

    Hi First time here and first time to any vba or coding forum. Been programming for 12 years now, mostly in VBA and C and this is the first time I've looked for help.

    Its something so simple, yet for some reason I am not getting the results I expect. Hoping some of you could provide some insight.

    I have a simple function that breaks down data into "Pie Slices" - percentages of the whole. To ensure I'm not losing information, I created a test to see if my Pie Slices total 100% (or 1). The Code is as follows:

    Please Login or Register  to view this content.
    The test is:
    Please Login or Register  to view this content.
    It started out simpler than that as
    Please Login or Register  to view this content.
    , but a value of 1 would prompt the msgbox, so I broke it down. Pretty much, a value of 1 may or may not fail the less than test. It is not consistent. I feel that data is being lost, but the rounding of the values should prevent that, shouldn't it?

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Simple If-Then test giving unexpected results

    Hi, CM1227,

    please do not duplicate your threads by creating a new one if you want some things altered, you are allowed to edit any post for 48 hours if you feel you need to (or ask a moderator to do thereafter).

    Answers please at http://www.excelforum.com/excel-prog...d-results.html, thanks.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    05-17-2014
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Simple If-Then test giving unexpected results

    I'm sorry. I was using google Chrome. It wasn't showing certain elements and when i refreshed, it duped my post.

+ 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. [SOLVED] Simple If-Then test giving unexpected results
    By CM1227 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-18-2014, 04:00 PM
  2. [SOLVED] Using Index Match or Vlookup giving unexpected results on imported data
    By jacob@thepenpoint in forum Excel General
    Replies: 2
    Last Post: 07-03-2012, 05:49 PM
  3. Formula giving unexpected results
    By johnmerlino in forum Excel General
    Replies: 6
    Last Post: 12-01-2010, 01:20 AM
  4. Autofilter giving unexpected results!
    By Colin Vicary in forum Excel General
    Replies: 3
    Last Post: 09-28-2006, 07:20 AM
  5. Equation giving unexpected results
    By Mike K in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-27-2005, 11:06 AM

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