I created an Excel tool into which really thousands of records are based on weighted averages calculations. And discovered Excel struggling in term of permormance.
The issue is: the user needs to uploads a couple of times in a day new data for further analysis, and the only way to make the Excel spreadsheat humanely usable (performance) was to calculate everything upfront.
To optimize the tool performance, I had to:
- First I made all weighted average calculations upfront when data is uploaded the first time. Leaving formulas in the tool was not viable, since this tool run live analysis, every click would have been a pain of 30 sec at best to re-calculate new conditions,
- Second optimization was to not leave formulas into columns > as soon as a calculation is done, the macro copy/paste values
The formula I chose is sumproduct based weighted averages..
Here is my question:
1. Does it exits specific formulas in Excel to handle nicely large amount of weighted averages to calculate ?
2. Should I consider to use an external application (an Access table, SQL or whatever) to perform those weighted average calculations quickly/quicker.
DATA: D1:D11 contains either blank cells or a dollar figure from a payroll check. E1:E11 contains either blank cells or the date of the check.
Current Situation: Using the following formula I obtain a weighted average of the pay checks, not including the largest. =(SUM(D1:D11)-MAX(D1:D11))/(COUNT(D1:D11)-1)
Problem: I desire to calculate the weighted average based on the checks issued only prior to a certain date. I have used SUMIF() in other parts of the workbook successfully but needing to withold the largest value has presented me with a problem I can not find a solution to. =SUMIF((E1:E11,">="&TargetDate,D1:D11)-MAXIF(E1:E11,">="&TargetDate,D1:D11))/COUNTIF(E1:E11,">="&TargetDate,D1:D11)
I am looking for a way to get a weighted average to work without the need of helper columns, when my weights are stored in one range, and the actual values are stored in another range, but might not be sorted in the same fashion.
For example; range 1 might be:
Weight Homework 120% Pre-Exam 30% Exam 50%
But the range for student's scores might be in a slightly different order:
Scores Exam 90 Pre-Exam 72 Homework 1 81
(Note that this is a greatly simplified example and that just resorting would be impractical).
On another thread I found a solution to creating a weighted average given a pair of columns of numbers but I have column B consisting of values given as High, Medium and Low and the weighted column C of 1, 2 or 3.
How can I use the formula below to accomplish this, or is this maybe not the right way to created a weighted average?
I have a spreadsheet that tracks productivity for various parts being made basically pcs made per hour against how many pcs should be made per hour shown in a percentage of 100 percent
For example: Part ABC - ran 450 pcs per hour. The rate is 9500 so it ran at 4.74% of the goal
The machine runs about 50 parts.
They had me create a sheet/chart to graph productivity. They told me to just take an average of all the percentage rates the individual parts are running at.
I believe this is where a 'weighted average' should come into play? Taking an average of all those averages is not going to give an accurate overall productivity percentage is it?
How would I go about making a 'weighted' average (if that is indeed necessary) to get an accurate productivity percentage?
I am trying to calculate final grades with weighted averages. However for the final grade I need to drop the lowest of the test grade which come after the bold line to the right, making the total relative weight of Tests, the weight of 2 tests. How would I go about calculating that with a SumProduct formula? I do not need to drop grades from B4:K4, however from L4:N4 I need to drop the lowest grade for my final grade, which needs to be rounded to the nearest integer. The relative weight of each assignment is given in Row 1.
I have made this vba to go out and look at 2 different locations which contain simular folder names.
The script then writes the folder names in Column A, followed by the Size of both the folders from the 2 locations. The script is comparing the second location folder name to what the first process put in Column A so the folder names will be aligned with the file sizes. It is also converting the file sizes from bytes to the most appropriate one.
The problem I am having here, is once I put the second part in for the second folder, the script is either taking forver (More than an hour) or is freezing. So I am not sure if I put it in a loop somewhere or what exactly is happening. I am just wondering if I can get some help troubleshooting and optimizing this code....
I'm trying to find definitions/commands to make excel find the best combinations of several defined scopes and restrictions to make an output number as high as possible.
This is by using a combination of several different equations, maybe excel has a magic trick for all the variables and formulas.
A good place to start is to add some "timer code" in your macro. Add a small routine that saves a time value, and another routine that compares that saved value to the current time and displays the difference. At the beginning of a section of code you want to analyze, you call the first routine (which saves the start time), and then at the end of the section of code you call the second routine. In that way, you can determine which portions of your code are taking the longest time to execute. These are the code sections you then focus on, so you can figure out what they are doing that is taking so long.
The idea is that I start out with a number of XML files, which I'm trying to manipulate to calculate descriptives and make graphs of in Excel.
So I've made a large "script" in VBA to accomplish these goals, which works, but I'm trying to optimize the code step by step.The overall process that I want to achieve, consists of :
1) Open the XML in Excel as an XML Table
2) Use the filters in the top row of that XML Table to select the data that I want to use
3) The resulting selection consists of data in 6 columns of which I only wish to select column 2, 5 and 6
4) I only wish to select the data in the table of column 2, 5 and 6 (without the header and only the cells in the table) and copy
5) Last step is to paste this data in Sheet "Calculations"
The step I'm working on right now, is step 3-4. My current code is: [Code] ......
This does the job, but I'm trying to optimize it, since I'm handling tons of XML files and I'm performing this copy function a number of times per XML file.
This copies the data of all the columns in the table for the cases that meet the selected criteria, but I'd like to make an even stricter selection of only column 2, 5 and 6 to not waste space and processing power.
So I tried to select the data from the 3 columns and combine them with the Union function, to copy them as one array to the sheet Calculations.
Optimized a similar VBA code to: [Code] ........
But I'm having issues with getting the right selection method and when I run the macro, I get the error message that the Copy and Paste area aren't the same size.
I tried to alter my initial code to something in the line of : [Code] ..........
But I get error messages 1004 : Method 'Range' of Object '_Global' failed.
I've also tried [Code] ........
But this seems to select the whole column, including the header and tons of rows even after the table ended.
Aim: To create a Macro to hide all rows where the date in column D is before today. Column D has about 600 rows.
Current solution:
Code: Sub Hide_Old2()
'Worksheet name With Worksheets("Schedule") 'set start of date range Set rngStart = .Range("D2") 'find end of date range
[Code] .....
The problem with this solution is its speed, or lack thereof. It causes the screen to hang and flicker while it cylces through. Is there some way to create a range based on the date and hide the range? or another solution?
Note: Autofilter is not an option, as the spreadsheet with the dates needs to be kept simple for other stakholders and the macro is being run from another sheet.
I have a large dataset that includes information on the investment payout ratios of US companies over the period 2004-2006. I need to calculate the weighted average investment ratio for each company---see sample below
Microsoft Excel - example.xls ....
[HtmlMaker 2.42] To see the formula in the cells just click on the cells hyperlink or click the Name box PLEASE DO NOT QUOTE THIS TABLE IMAGE ON SAME PAGE! OTHEWISE, ERROR OF JavaScript OCCUR.
The corresponding weight for each year must be as follows: 0.5 for 2006, 0.3 for 2005 and 0.2 for 2004. Then, for company A, the weighted average will be: (0.5*B2)+(0.3*C2)+(0.1*D2) = 7.8 (see cell E2)
The problem is that for some companies there are missing data for some years. For example, for company B, there are no data available for year 2004. In this case , the weights have to change to 0.6 for 2006 and 0.4 for 2005. Then, the weighted average investment for company B will be (0.6*B3)+(0.4*C3) = 16 (see cell E3). Similarly, in cases when there are data for only 1 year , the weight has to change to 1. Then, for company C the weighted average is 35 (see cell E4)
Is there any formula to give me the weighted average as it appears in column E without having to adjust it for each single case?
I'm doing a GCSE project for which I need a little help with Excel.
I have a set of data about a persons monthly spending habits on
Food 300 Entertainment 200 Clothing 100 Transport 260
The pre calculated budget allowance for the month was 500
I would like to write a formula that would do the following; give the person an score out of 1.1-10 based on how well he spent on the above items which are in order of priority (i.e. it is better to spend more on food than on entertainment etc) And then an over all score (1.1-10) that will reflect how well they spent.
In Col DL are digits ranging from 1-36, in Col Dm are the number of times they were drawn in 36 draws. I have a weighted avg formula in Col DN, that I found thru search, but it doesn't appear to be working right or maybe I don't understand the formula. I have no idea if this can be done.
************************************************************************>Microsoft Excel - F5 HOT-COLD.xlsx___Running: 12.0 : OS = Windows XP (F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp (A)boutDN3DN4DN5DN6DN7=DLDMDNDO2DIGITSHITS 34125 47105 53395 62185 72885 DIGITS [HtmlMaker 2.42] To see the formula in the cells just click on the cells hyperlink or click the Name boxPLEASE DO NOT QUOTE THIS TABLE IMAGE ON SAME PAGE! OTHEWISE, ERROR OF JavaScript OCCUR.
Column A is the key. If multiple rows have the same key, they're related.
The last column (DX on my spreadsheet) represents minutes participated, and is the weight variable. The middle columns are data that I'd like a weighted average for.
Here is the output I'm looking for given the above example:
Column A remains the same, with one row for each key. The middle columns have their weighted average (where 6.66 = (5*20+8*13+7*46)/(20+13+46)), and the final column (DX) is the sum of minutes for all like keys.
I have long lists of data which has name of manufacturer, number of items and fault rates of items.
E.G
Manufacturer.......Number of Items......Fault Rate Dell....................40000....................0.2% Dell....................42200....................0.4% Sharp.................303003..................0.1% Microsoft.............312340..................0.04% Dell....................3249321..................1% Panasonic............300020...................2%
I need to find the weighted average of each manufacturers fault rate for just themselves, and also how the average of all the manufactueres would be if they weren't in it.
So for example for Dell I would need their weighted average of their three data entries and also then the weighted average of Sharp, Microsoft, Panasonic together.
I have been doing this by splitting the data into sections so for the example above I would do:
Manufacturer.......Number of Items......Fault Rate Dell....................40000....................0.2% Dell....................42200....................0.4% Dell....................3249321..................1% Panasonic............300020...................2% Sharp.................303003..................0.1% Microsoft.............312340..................0.04%
I would sum the Dell items, then sum the number of items excluding Dell then do two weighted average calculations giving me the ones that include then the ones that exclude Dell.
Then I would do...
Manufacturer.......Number of Items......Fault Rate Sharp.................303003..................0.1% Microsoft.............312340..................0.04% Dell....................3249321..................1% Dell....................40000....................0.2% Dell....................42200....................0.4% Panasonic............300020...................2%
And do the same process but with Sharp totals etc then move onto the next one.....
This example is with a very small data set so I'm sure you can see that this process is very time consuming, but I don't know any other way of doing it without splitting out the data first.
I am trying to find a formula that will calculate a running total of employee time off. Time off is recorded in Excel spreadsheets that I created. V = vacation, S = sick, PD = personal day, and so on.
For example: If a V is entered in any cell in their attendance worksheet, I would like for a 1 to display under the vacation total column. The next time a V is entered in, I would like it to update the cell containing the vacation days used for the year to 2. If a 1/2 V is entered, a .5 would be added to the total used.
I am working on a spread sheet and am trying to use rolling averages of the last 3 months. I am using worksheets for each month with a final worksheet containing the 3 mo. rolling average. I tried using a formula with OFFSET and it worked fine if all the data was in 1 worksheet, but did not work for multiple worksheets averaging to another worksheet in the same workbook.
I am trying to work out the average volume of our daily downloads. I have used Vlookup to automate this. When there is no data it returns #N/A which is no problem. The problem arises when i try to work out the average for the month or peaks (MAX sum).
I have tried several variations of sumif/if/isna etc etc and am not having much luck. Below is an example of what i am trying to average out: #N/A620#N/A
That is 4 different days download data - I want it to ignore the 0's and #N/A and return the average for the days we actually had a download.
If I have a varying number of figures(say between 4 and 10) which I want the average of the first half of the set and an average of the second half, is there a function which I can use to calculate this? ie if there is 8 numbers in total then I need the average of the first four and last four... but if there is ten figures total then I need the average of the first five and last five.
I am inputing each day the total amount of sales. I am manually doing the averages for past 12 weeks on Monday sheet. I would like when I enter the amount for that week that the cells B84, C84, E84, F84 are automatically updated for the past 12 weeks. I have tried a few different approaches but I keep getting #ref or circular reference
We are trying to get an Average between 2 columns that have the same conditions. We have been using an array formula succesfully on data that is on 1 column and I have trying to incorporate an Offset into the formula with no luck. Here is our latetest attempt, WITHOUT THE OFFSET. The data is in Column P and Column N
=AVERAGE(IF((('Mill Process Data'!N3:N6650,'Mill Process Data'!P3:P6650>.01)*('Mill Process Data'!N3:N6650,'Mill Process Data'!P3:P6650<.3))*(ISNUMBER('Mill Process Data'!N3:N6650,'Mill Process Data'!P3:P6650)),Mill Process Data'!N3:N6650,'Mill Process Data'!P3:P6650)))
I want a cell that takes each row in column B and subtracts column A from it... (10-5 for row 1). I want it to do that for all rows and then average that number. This would be easy if I were not using a pivot table with a lot of data.
For example: Column A Column B 5 10 2 9 6 8 1 4 6 7 1 1 6 2 6 8
I havea list of values that I need to work averages out for. Unfortunately, sometimes the values will be a zero and these should be ignored.
I can work out the averages easily enough using the average function, but can't quite figure out a way of ignoring the zeros. Sample data would be :- week 1 - 3.42 week 2 - 0 (zero)
Using the standard average function, I get an average of 1.71 when I actually want it to have an average of 3.42.
I would prefer a function for this but would settle for a macro even though it would increase the program run-time.
B6,J6,R6,Z6, and AH6 and a total average on cell AP6
How would I go about making a formula for that. The reason why I ask is because all the info I have seen refers to the cells with the averages need to be in sequence or range and nothing about the cells being seperated. I also tried using the countif method, but same prob, the cells need to be within a horizontal or vertical range
I need to calculate average for last 12 valid entries in a column. I say valid because if there are blanks or zeros in the cell they need to be discounted.
The solution needs to work on percentages as well.
To explain further Col A Col B Jan 2007 1 Feb 2007 5 Mar 2007 5 Apr 2007 0 May 2007 Jun 2007 20 Jul 2007 0 Aug 2007 Sep 2007 10 Oct 2007 0 Nov 2007 10 Dec 2007 18 Jan 2008 8 Feb 2008 6 Mar 2008 0 Apr 2008 May 2008 10 Jun 2008 1
The requirement would be to calculate average from Jun 2008 backwards for 12 months where there aren't zero or blank entries.