+ Reply to Thread
Results 1 to 8 of 8

Thread: field division problem

  1. #1
    Registered User
    Join Date
    10-15-2010
    Location
    Sacramento, CA
    MS-Off Ver
    Excel 2007
    Posts
    54

    Thumbs up field division problem

    Hi, im stuck on a new issue with my table, what I have is a query that pulls from table: The names are as follows
    Centro, tipos, Divisao, SomaDeMonth, SomaDevalcont, Valcontdivision, Final
    What I have correct is the Somademonth, somadevalcont, the problem im having is with the formula for Valcontdivision, and Final.
    the Formula for Valcountdivision should be Tmonthsum/Valcount sum, however, it doesn't do this, the formula I have is
    divide: Soma(SeImed([valcont]=0;0;[months]/[valcont]))
    The total is suppose to be 867917, but I get a I different #. Im not sure how to divide by the somademonth field/somadevalcont field...

    Then the other Final, is suppose to be [QUOTE]final: ([divide]/12)QUOTE]
    The true # should come out to be 45,83281616 etc... However, Im having some difficulty with the last 2.

    Anyone have any ideas what im doing wrong with the formula, I think the major problem is the formul I have for Valcountdivision.

    Any help would help, I tried attaching the access but wouldnt work,
    Attached Files Attached Files
    Last edited by gill389; 12-14-2010 at 06:29 PM. Reason: uploaded file

  2. #2
    Valued Forum Contributor alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Lake County, Illinois
    MS-Off Ver
    MS Office 2010, 2007 and 2002
    Posts
    1,161

    Re: field division problem

    I tried attaching the access but wouldnt work,
    You need to zip Access files before you upload them. Try again, it will make it easier to help solve your issue. Scroll down and select Manage Attachments. You are using fields named ValCont and tmonth, yet I don't see them as fields in your query. Is this a typo or have you neglected to select them from your table?

    Alan
    Last edited by alansidman; 12-09-2010 at 01:44 PM.

  3. #3
    Registered User
    Join Date
    10-15-2010
    Location
    Sacramento, CA
    MS-Off Ver
    Excel 2007
    Posts
    54

    Talking Re: field division problem

    The last 2 i created as expressions, and named them in the query... I uploaded the access table I have. Thanks

  4. #4
    Valued Forum Contributor alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Lake County, Illinois
    MS-Off Ver
    MS Office 2010, 2007 and 2002
    Posts
    1,161

    Re: field division problem

    You have posted a db with 20K records. I do not have the time or inclination to validate your data in your query as this would take hours. Would you post only sample (dummy) data that can be quickly validated to determine where there is an issue. Initially your query looks ok, but I have no way to validate the data with the results.

  5. #5
    Registered User
    Join Date
    10-15-2010
    Location
    Sacramento, CA
    MS-Off Ver
    Excel 2007
    Posts
    54

    Re: field division problem

    I wouldn't ask you to validate the entire table, but if you run the query its consolidated to only 5 lines or so, I was trying to see if my division formula was right, I'm not sure why its not doing what I want it do, as Im not good at access formulas, if you can guide me with the formula id appreciate it. Ill create a dummy file with table of only 30 or so data..

    Thanks for your help,

  6. #6
    Valued Forum Contributor alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Lake County, Illinois
    MS-Off Ver
    MS Office 2010, 2007 and 2002
    Posts
    1,161

    Re: field division problem

    The reason I want to be able to validate is that the formula looks ok to me. I would want to be able to ensure it is working properly by being able to ensure its validity with a smaller sample. Will be travelling for a few days and may be absent from the forum until I return.

    Alan

  7. #7
    Registered User
    Join Date
    10-15-2010
    Location
    Sacramento, CA
    MS-Off Ver
    Excel 2007
    Posts
    54

    Re: field division problem

    added new modified smaller version of the table,

    SomaDeValcont SomaDemonths divide final
    64508 16928942,5 54,97 4,58
    312267 305304242,3 16.693,53 1.391,13
    566 362572655,94 20.098,52 1.674,88
    For example # 2 305304242,3/312267, if you divide Months/valcount the # is 977.7026 and then if you divide by 12 I get81.752.
    The formula I have gives a different answer
    divide: Soma(SeImed([valcont]=0;0;[months]/[valcont]))

    Im not sure what im doing wrong, because if I hit group by in the field tabs of DIVIDE, then it divides correctly; but it shows every single order.

    WHen I dont have "group by" and the 2 fields SomaDeValcont SomaDemonths, sum the total, it wont divide months/Valcont correctly, im not sure why
    let me know what u think, when you get back, no rush, appreciate your help
    Last edited by gill389; 12-10-2010 at 01:57 PM. Reason: added some new comments

  8. #8
    Valued Forum Contributor alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Lake County, Illinois
    MS-Off Ver
    MS Office 2010, 2007 and 2002
    Posts
    1,161

    Re: field division problem

    I took a look at your query and I think the problem is that you really need to do the calculation on the Alias Fields and Access won't let you do that in the same query. So you used the original Valcont Field which because some of the records have zeros in them gives you a "bad" answer. To make this work, you must do the expressions in a query based upon the first query. Look at the attached in which I created a new query with the expressions as you showed in your db based upon the information obtained in your original query. I hope the results are as you desire.

    Alan
    Attached Files Attached Files

+ 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.2.0