Results 1 to 2 of 2
  1. #1
    sarah is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2009
    Posts
    1

    Averaging with a conditional check

    Hi,




    I am trying to figure out an efficient formula for a weighted average of a long series of numbers:

    ([Mercer #1: Weighting]*[Mercer 1 Base 25th %ile]) + ([Mercer #2: Weighting]*[Mercer 2 Base 25th %ile])+……)/([Mercer #1: Weighting]+[Mercer #2: Weighting]+………)


    The problem is, there are null values for many of the “Base 25%ile” numbers and therefore the weighted average does not calculate unless there are values for all the “Base 25%ile” fields. Ideally, the formula would just average the fields in which there are numerical values and ignore the rest. Is there an efficient way to rewrite the above formula? My first thought is to do a isNull check for every “base 25 %ile” but this formula would get very complicated and long since there are many fields we would have to check for. Any advice would be greatly appreciated!!


    Thank you!
    Sarah
    Last edited by sarah; 10-02-2009 at 05:57 PM.

  2. #2
    dcrake's Avatar
    dcrake is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    435
    Are all your base fields in a single table?

    Mercer 1 Base 25th %ile
    Mercer 2 Base 25th %ile
    Mercer 3 Base 25th %ile

    etc.

    If so, this is not the correct way to do this. Your database tables need normalising.

    In the mean time you could create a union query to normalise them

    Select ID, [Mercer 1 Base 25th %ile] As Base, 1 As Cnt From Table Where [Mercer 1 Base 25th %ile] Is Not Null

    Union

    Select ID, [Mercer 2 Base 25th %ile] As Base, 1 As Cnt From Table Where [Mercer 2 Base 25th %ile] Is Not Null

    Union

    Select ID, [Mercer 3 Base 25th %ile] As Base, 1 As Cnt From Table Where [Mercer 3 Base 25th %ile] Is Not Null

    Etc

    This will then give you a list of all base fields with values (Exludes Null Entries) Then this will give you a more weighted average.

    If you then group by ID and base your calulation on the base / sum (cnt) to tell you how many have values. I Think.

    David

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Conditional formatting in report
    By RickM in forum Access
    Replies: 1
    Last Post: 09-10-2009, 06:21 PM
  2. count with conditional
    By humpz in forum Reports
    Replies: 3
    Last Post: 08-02-2009, 08:11 AM
  3. Conditional formatting
    By ylivne in forum Reports
    Replies: 1
    Last Post: 07-12-2009, 06:18 PM
  4. Issue with conditional imput
    By Estyl in forum Forms
    Replies: 2
    Last Post: 02-19-2008, 10:42 AM
  5. Conditional Format Query
    By Schwagr in forum Queries
    Replies: 3
    Last Post: 03-20-2006, 02:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums