I'm trying to calculate a standard deviation for each record in a database...the record has 12 fields which contain consumption for each month of the year. I want to calculate the standard deviation of those 12 fields but it seems like access is wanting to calculate only on one field...
Is there any way around this or am I just not understanding how it works?
I'm fairly new to access and don't know anything about VB and some of the sql statements...
9 23410
I'm trying to calculate a standard deviation for each record in a database...the record has 12 fields which contain consumption for each month of the year. I want to calculate the standard deviation of those 12 fields but it seems like access is wanting to calculate only on one field...
Is there any way around this or am I just not understanding how it works?
I'm fairly new to access and don't know anything about VB and some of the sql statements...
The following link should enable you to solve your problem: http://support.microsoft.com/kb/209839
The following link should enable you to solve your problem: http://support.microsoft.com/kb/209839
Thank you for the response but VB is not something I've ever used. Do I just cut-n-paste the module code into my database? Or do I need to change something in it's coding?
I'm trying to calculate a standard deviation for each record in a database...the record has 12 fields which contain consumption for each month of the year. I want to calculate the standard deviation of those 12 fields but it seems like access is wanting to calculate only on one field...
Is there any way around this or am I just not understanding how it works?
I'm fairly new to access and don't know anything about VB and some of the sql statements...
Hi, there.
You have two options: - within a query you may use StDev or StDevP aggregate functions
- in VBA you may use DStDev or DStDevP domain aggregate functions
Hi, there.
You have two options:- within a query you may use StDev or StDevP aggregate functions
- in VBA you may use DStDev or DStDevP domain aggregate functions
The StDev or StDevP seems to only work on one field within a record where I want to look at 12 fields which are by month. I attempted to use it but it won't recognize more than 1 field....or so it seems.
Example: I have a material number and then usage for Jan, Feb, Mar, Apr, May, thru Dec. I want to find the Std Deviation for those 12 months of data.
The StDev or StDevP seems to only work on one field within a record where I want to look at 12 fields which are by month. I attempted to use it but it won't recognize more than 1 field....or so it seems.
Example: I have a material number and then usage for Jan, Feb, Mar, Apr, May, thru Dec. I want to find the Std Deviation for those 12 months of data.
That is because you have an improper table structure. Month usage should be in different records, not in different fields.
Take a look at Database Normalisation and Table structures tutorial.
If you are not willing to reorganize your tables structure, then read this stuff.
Thank you for the response but VB is not something I've ever used. Do I just cut-n-paste the module code into my database? Or do I need to change something in it's coding?
FishVal's comments about normalization are valid, and should be implemented in your database. However, I believe the functions included in the link will enable you to do the computations you want using your existing database structure, although I have not personally used them.
Just cut-n-paste the module code in your database, and compile it. then you will be able to call the included functions and pass arrays consisting of your column(field) values. The included functions utilize the statistical function options mentioned by Fish. Hope this helps.
I'm trying to calculate a standard deviation for each record in a database...the record has 12 fields which contain consumption for each month of the year. I want to calculate the standard deviation of those 12 fields but it seems like access is wanting to calculate only on one field...
Is there any way around this or am I just not understanding how it works?
I'm fairly new to access and don't know anything about VB and some of the sql statements...
- Copy and Paste the following Function to a Standard Code Module:
- Public Function RStDev(ParamArray FieldValues()) As Variant
-
-
'---------------------------------------------------------
-
-
' Function RStDev() calculates the Standard Deviation of
-
-
' sample data passed as arguments. NOTE: The standard deviation
-
-
' of sample data is only valid if more than one argument is
-
-
' numeric.
-
-
'---------------------------------------------------------
-
-
Dim dblSum As Double, dblSumOfSq As Double
-
-
Dim n As Long, varArg As Variant
-
-
For Each varArg In FieldValues
-
-
If IsNumeric(varArg) Then
-
-
dblSum = dblSum + varArg
-
-
dblSumOfSq = dblSumOfSq + varArg * varArg
-
-
n = n + 1
-
-
End If
-
-
Next
-
-
-
-
If n > 1 Then ' Variance/StDev applies if more than a single point
-
-
RStDev = Sqr((n * dblSumOfSq - dblSum * dblSum) / (n * (n - 1)))
-
-
Else
-
-
RStDev = Null
-
-
End If
-
-
End Function
- Make you own modifications, but for test purposes I created a Table named tblStandardDeviation.
- tblStandardDeviation consists of an [ID] Field (Primary Key){AutoNumber}, and 12 Fields named [Field1] through [Field12]. Set the Data Type of these Fields to Double.
- Create the following Query, substituting your Field Names for the generic [Field1] through [Field12].
- SELECT Val(RStDev([Field1],[Field2],[Field3],[Field4],[Field5],[Field6], [Field7],[Field8],[Field9],[Field10],[Field11],[Field12])) AS Std_Deviation
-
-
FROM tblStandardDeviation;
- I do believe that you will arrive at the correct results.
- Please give puppydogbuddy the credit for this one, he pointed you in the right direction with the proper Link. I just followed in his footsteps and implemented what he had already found.
NOTE: As indicated in the Link, Microsoft Access has several built-in functions that enable you to perform statistical analysis across Records, it does not have a built-in function to perform statistical analysis across multiple columns within a single row. This is why the need for a Custom Function to perform this task.
ADezii,
Thanks for confirming the validity and relevance of info that I provided, and for the excellent job you did of filling in the missing detail that I was not familiar with.
pDog
ADezii,
Thanks for confirming the validity and relevance of info that I provided, and for the excellent job you did of filling in the missing detail that I was not familiar with.
pDog
Always a pleasure working with a fellow Expert.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: wlcna |
last post by:
mysql v4.0.16:
I had been using mysql with innodb and thought that was fine, until i used
it for something requiring a few - perhaps slightly involved - joins, and
have now seen the performance...
|
by: alisae |
last post by:
Hello. I have a HP6630 Computer, Windows Xp Professional, Office Xp
Standard Edition and a standalone version of Microsoft Access 2000 sr1
on a separate cdrom. The problem is every time I want to...
|
by: Skipper_23 |
last post by:
can anyone help me out, how to use multiple tables in one form using
microsoft access?
|
by: Pam Ammond |
last post by:
I need to use Microsoft Access Automation within a Visual Studio 2003 program
written in C# for Windows Forms. When a button is clicked in my VS.NET
program, I want it to run a Microsoft Access...
|
by: Andrew S. Giles |
last post by:
OK, I am trying to prototype a data import function, and the Data Import
Wizard from Microsoft Access is what we wanted to pattern our importer off of.
How do I get to this wizard inside the...
|
by: bbdobuddy |
last post by:
Hi,
How do I open a Microsoft Access 2003 form from Visual Basic.net
Thanks in advance
bbdobuddy
|
by: somersbar |
last post by:
hey,
ive been trying to set up a web form in visual basic.net that can
access a microsoft access database. i need to use odbc also. i can get
it working using a windows form but not a web form....
|
by: somersbar |
last post by:
hello all,
im trying to connect to a microsoft access database from an ASP.NET web
form.
i keep getting the following error though:
ERROR Could not use
'(unknown)'; file already in use....
|
by: bazzer |
last post by:
hey,
im trying to access a microsoft access database from an ASP.NET web
application in visual basic 2003.NET. i get the following error when i
try running it:
Server Error in...
|
by: Dave Smith |
last post by:
I was assuming that this would be something I could find on the web, but I'm just not finding it I'm not.
How would I get I use a query to get the Standard Deviations?
From what I read it should...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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...
|
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...
| |