473,405 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Weighted Averages in Access based only on certain values

Hello,
Hope you can assist me. I am trying to calculate weighted avg in the field based only on certain values. The field contains response ratings received from the survey between 1-5. I am trying to calculate weighted % only for responses with ratings 4 and 5. Would you please direct me to what expression formula can be used for this?
Oct 17 '13 #1
7 1214
ADezii
8,834 Expert 8TB
Create a Query restricting Response Ratings to 4 and 5 only, then apply Weighted Averages to the Result Set. To restrict Response Ratings:
Expand|Select|Wrap|Line Numbers
  1. SELECT Table1.*, Table1.[Response Ratings]
  2. FROM Table1
  3. WHERE (((Table1.[Response Ratings])=4 Or (Table1.[Response Ratings])=5));
Oct 17 '13 #2
Thank you. I am relatively new to Access. In the query that I already have I have 5 fields where responses can be 4 and 5. So I need to be able to weight avg each of the field on 4 and 5 responses. Also, is there a way to write this as formula in expression builder since I needs this to be calculated on the report?
Oct 17 '13 #3
ADezii
8,834 Expert 8TB
Need greater detail along with some sample Data...
Oct 17 '13 #4
Here is the extract from the query I use for the report. What I am trying to accomplish to get weighted averages for each of the category with numbers on the sheet and base weighted avg % only on responses with ratings 4 and 5. More so, I need to do also weighted averages for:

1.For each Field (with response ratings)
2.For overall of all responses across fields with 4 and 5 ratings for each Company Name field
3.For overall for all responses across all fields for all companies per SVP.

All based only on responses with 4 and 5 ratings.

Not sure if this is confusing....


Expand|Select|Wrap|Line Numbers
  1. Report DateAM SVP    DeptIDCompany NameTravelerNameDKNumberPNRNNumberField1Field2Field3Field4Field5
  2. 14-Oct-13    Name1    521745    XYS    Name1    3351000101    GGGG    5    5    5    5    5
  3. 14-Oct-13    Name2    521210    ABC    Name2    3462000001    VVVV    3    5    5    4    4
  4. 14-Oct-13    Name3    104455    XXC    Name3    6791000101    UUUU    5    5    5    5    5
  5. 14-Oct-13    Name4    161130    CGF    Name4    7490060506    UUUU    5    5    5    5    5
  6. 14-Oct-13    Name5    523530    BKH    Name5    3841000101    QQQQ    5    5    5    5    5
  7.  
  8.  
Oct 17 '13 #5
zmbd
5,501 Expert Mod 4TB
Yoni Hasid:
Please be aware of the fact that attachments are not often downloaded by our experts/moderators for several reasons. In my case, my company's IT-Security policy prohibits doing so.

Instead, would you mind taking a small subset of your data in the Excel file and cut-n-paste. If you use the [CODE/] format button to place the [code] tags, the text will retain the intended spacing (with some minor tweaks (^_^) )

The other thing that will help will be to see the actual SQL in your query. If you will open the query in design mode, right-click in the table area, and select the SQL-View option. You will be taken to a view with the actual SQL behind the query. Please cut-n-paste this in a post, select the text and format it using the [CODE/] format button to place the [code] tags around the SQL text.
Oct 17 '13 #6
Please let me know if the data sample makes sense.
Oct 17 '13 #7
ADezii
8,834 Expert 8TB
There are several Algorithms that compute Weighted Averages and quite honestly I am a little confused as to exactly what you are looking for. What I did was to compute the Average of Fields1...Field5 and return an Integer Value. The only requirements are that Fields1...Field5 cannot be NULL and that they are Integer Values.
  1. Table1:
    Expand|Select|Wrap|Line Numbers
    1. SomeName    Field1    Field2    Field3    Field4    Field5
    2. ABC           13         12        40        20        15
    3. DEF          123        561       987       444       334
    4.  
  2. Function definition:
    Expand|Select|Wrap|Line Numbers
    1. Public Function fCalcAvg(lngF1 As Long, lngF2 As Long, lngF3 As Long, lngF4 As Long, lngF5 As Long) As Integer
    2.   fCalcAvg = ((lngF1 + lngF2 + lngF3 + lngF4 + lngF5) / 5)
    3. End Function
    4.  
  3. SQL:
    Expand|Select|Wrap|Line Numbers
    1. SELECT Table1.SomeName, Table1.Field1, Table1.Field2, Table1.Field3, Table1.Field4, Table1.Field5, 
    2. fCalcAvg([Field1],[Field2],[Field3],[Field4],[Field5]) AS Average
    3. FROM Table1;
  4. Query Results:
    Expand|Select|Wrap|Line Numbers
    1. SomeName    Field1    Field2    Field3    Field4    Field5  Average
    2. ABC           13         12        40        20        15     20
    3. DEF          123        561       987       444       334    490
    4.  
Oct 18 '13 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Andy | last post by:
Hi! Is possible to do xml validation of one xml block based on values from another xml block? For example, I have an input xml file containing account types. <Root> <AccountTypes>...
0
by: Bob Alston | last post by:
I am still looking for MS Access based software for managing client services for a basic human needs agency. These agencies I am working with provide food, clothing, personal care items and...
4
by: Bob Rock | last post by:
Hello, I'd like to programmatically access keys and values of on .resources file embedded in my assembly. I've seen that the assembly class provides the GetManifestResourceStream method .......
5
by: sklett | last post by:
I'm not real experienced with asp.net so this may be obvious. I've got a situation where some of my client side javascript is causing my posted form's controls to lose their values. In other...
1
by: Rajasuds | last post by:
I have a question in MS Access I have two tables MASTER with Fields 1, Field 2, Field 3 TRANS with Field1, Field 2, Field,10 I need to set up a look up condition where, I need !Field 2 to...
1
by: gretchen | last post by:
I'm a fairly new access user so my question may be simple but I still need help! I have a form and a subform. I want to run an append query and populate the subform based on values in the form. I...
5
by: BerkshireGuy | last post by:
I have two functions that calculate two numbers based on based in parameters. So, the functions return a value. Is there a way to create a chart based on values from a function? The only...
0
Gyanchand
by: Gyanchand | last post by:
Need to generate a word document using a template in ASP by inserting certain values at runtime. Can sum1 plz. help me figure out how can you write to a word file... tried using...
3
by: damola | last post by:
Good day everyone Please how can i prevent access to certain forms in ms access database 2007. i want it to be in such a way that when i enter user login,it automatically detects the forms the user...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.