Using Excel To Calculate Weighted Standard Deviation?

Dec 4, 2012

Formula for computing the weighted standard deviation? I was able to calculate the weighted average (16.4) but have been unsuccessful in computing the weighted SD. I conducted numerous searches and have not been able to find a posted formula that actually works. My data are as follows:

I am trying to calculate the Standard Deviation of an array. However, to populate the array, I have the following:

Count Number 1 Count Number 2 CountNumber 3 1 100 2 200 3 300

For example, this above means that there are 1 100's, 2 200's, 3 300's. I would ideally like to populate an array that is {100,200,200,300,300,300} based on those 6 columns that provide a count and a number. Then, I would like to calculate the standard deviation based on those (in this case it is 74.5).

I have a seris/column of numerical data for which I want to work out percentage differences and then calculate the standard deviation of the percentage differences for all values

For example in column A, I have

row 1 10 row 2 15 row 3 17 row 4 10

I want to work out % difference between row 1 and row 2 (which is 50%), row 2 and row 3 etc and the get the standard deviation of thoose % changes.

I know how to do this on the spreadsheet using formulas but I want to do it using a macro so that the macro returns the standard deviation of the percentage changes because I do not want to have any data showing on the spreadsheet other than the raw data.

kkknie kindly provided the following UDF to work out the the average of the percentage changes but is there code that will work out the standard deviation instead?

I thought maybe excel's built-in standard deviation function (stdev)could be incorporated somewhere into the code but I'm not sure how!

An age-old controversy has resurfaced in our lab regarding the calculation of a mean and standard deviation of a set of two numbers. There have always been those who say that you can't have a standard deviation of two numbers, but now someone has said that a mean of two numbers is meaningless (no pun intended). What is the current thinking on this? Of course, mathematically speaking, you can certainly calculate these values with only two numbers, but is a mean of two numbers not considered a valid measurement? How about a standard deviation?

I'm trying to create a VBA piece to calculate the standard deviation of the difference of two arrays. I have two columns of data and i want to create a third column that is the first minus the second and them calculate the standard deviation of that. My problem is that i wanted to do all of this behind the scenes in VBA (didn't want to output the third column).

ColorFunction is a great tool, but I would like to use it to calculate the Standard Deviation of color filled cells. Can the following code be modified to do this?

Function ColorFunction(rColor As Range, rRange As Range, Optional SUM As Boolean) Dim rCell As Range Dim lCol As Long Dim vResult lCol = rColor.Interior.ColorIndex If SUM = True Then For Each rCell In rRange If rCell.Interior.ColorIndex = lCol Then vResult = WorksheetFunction.SUM(rCell,vResult) End If Next rCell Else For Each rCell In rRange If rCell.Interior.ColorIndex = lCol Then vResult = 1 + vResult End If Next rCell End If ColorFunction = vResult End Function

I've daily data of a stock indices returns and I would like to calculate the monthly standard deviation. Currently, I'm using the following worksheet functions: =STDEVP(C2:C20)*SQRT(COUNT(C2:C20))

However, the range changes from month to month, which makes the process of calculating the monthly standard deviation to be quite tedious if I've about 10 years worth of data. I assume I could somehow substitute the range with a dynamic range, but I'm struggling to come up with the correct formulation that would do that.

What I want to do is calculate in VBA a moving 3 day standard deviation of returns. So I want the first calculation to include jan 1 - jan 3 and place the answer in the cell to the right of jan 3 return. Then move down 1 row and calculate the standard deviation using jan 2 - jan4 and place the answer in the cell to the right of jan 4 return...and so on until the last cell.

The spreadsheet below shows the Date (Column A), Percentage (Column B), and Standard Deviation (Column C). What I would like is a macro that finds the standard deviation for all percentages of a given date, and for the output to be placed in the first cell of Column C of that given date. If a cell in Column C is not the first for a given date I would like for it to be blank.

I have a dynamic range that I need to be able to calculate the standard deviation for. The dynamic range sometimes has blank cells and #N/A cells which I do not want included in the calculation. However, there are sometimes cells with the number 0 in it (instead of blank) which I do want to include. I have come up with an array formula, but the standard deviation it calculates is not correct. The formula is:

=STDEV(IF(ISNUMBER(A3:A20000)*ISNUMBER(A3:A20000),1,0)). *This is an array formula calculated by pressing CTRL+SHIFT+ ENTER. The number it calculates is 0.43, however, this is incorrect. If you just calculate the standard deviation of the actual data points in excel (cells A138:A5055 in this case) : STDEV(A138:A5055), it returns 0.17. This is the correct standard deviation.

I have a sheet of data in which Column A contains a list of sales agents names and Column B contains their results against their KPIs. All the data is terribly skewed due to new metrics so I have been tasked with attributing 'ranking band' to their performance, i.e. very low, low, medium, high, very high.

I have calculated the average and standard deviation for the list of data, but now I need to calculate which ranges will fall under which ranking band, e.g. very low is less -18%, low is greater than 18% but less than 80%, etc.

I also need to come up with a nested if statement next to each of the sales agents so it returns what ranking brand they are on based on their performance. Sample sheet attached. EDIT - attachment on post #4.

Is there a way to do a stddevif of a sort? I have a flat file with thousands of records and based on criteria I group all records into specific buckets. I need to, without sorting, find the stddev of each group. Can this be done and if so does it require an array function (hopefully not). I dont mind having 3-4 additional columns of arguments to help me compute this (i.e countif, sumif, average, (Variance-average)^2, etc.).

I don't know too much about standard deviation, but I was wondering if somebody could help me with a function to find 1 standard deviation (68%??) from the largest value (not the mean value) within a column of values. What i'm really after is the 'standard deviation boundaries' either side (i.e. 34% of values above the largest value and 34% below the lowest value) as a highlight.

I am fairly new to VBA, i require some help creating a Standard Deviation UDF using arrays, i have made a userform that allows a user to select anywhere between 1 to 30 companies (A1: AD1) and its corresponding stockprices (A1:A60) in a sheet called companydata, using the following sub, my problem is that i am unsure how to create a function using the info the user selects. I have also created a returns function (below) but this is vba is saying that there is a out of range error, Will anyone be able to help please.

I want to find the correct formula to find answers using excel for the folliowing:

1. >3Sds2. 3SDs<>2SDs3. 2SDs<>1SD4. <1SDs

This question uses 3 sigma rule (see attached worksheet) and the formula needs to be re-arranged to meet new criteria. So, we need to consider both sides of nornmal distributiion (ND) curve. eg. when we say >3SD it means it should count all valuee falling in the rage "Mean(Average)+3SD AND Mean-3SD" i.e two extreme ends of the ND cureve. I have inserted a normal distribution diagram and colour coded the ranges so that it will be easy to identify. Please refer comments inserted in K7to N7, cells that contain formula that need to be reset.

I run data sets and use standard deviation frequently but will often times have an issue with the formula. For instance in the following example I use the standard deviation function for the $/Acre column and it returns a value, but using the same data set to try to get a value for the $/WFF column gives the #DIV/0! error message.