# Macro For Average Of Values - Dynamic Range Of Cells

Aug 1, 2013

I need to find average of the values , the count of the cells will be dynamic (may be 5 or even 200).

ADVERTISEMENT

## Excel 2003 :: Average Of Cells Which Are Not In Range Which Ignores Any Zero Values

Dec 4, 2013

I have a worksheet which has various figures for each day of the week however I need to establish the weekly average of these figures.

Due to the way in which the figures are displayed, I am unsure how to use a formula which does not require a range with cells located adjacent to one another.

I have attached a test sheet as an example. The cells in yellow require the formula and I need a weekly average for criteria 1-3. This formula also needs to be compatible in Excel 2003

Test Sheet.xls

## Dynamic Named Range - Select Only Cells With Numerical Values

Jul 21, 2006

Is anyone aware of some way to use the " dynamic named range approach" to only select the cells with numerical values in a column and name this range?

I've looked at the examples on this site but can't find any solution to this particular problem although I have a feeling that this should be possible.

## Formula: Average Value Of Cells Left Of Highest N Values In Above Column Range

Sep 24, 2006

I need a cell formula that will (a) identify the highest N values in an above specified column range, (b) color the interior of those N cells (I suspect that this is not possible), and most importantly (c) return the average value of N corresponding cells, where the corresponding cells are located on the same rows as the identified N high value cells but in a specified column to the left (not necessarily adjacent)

Does anybody know what this formula would look like?

Example:

-----------------------
...| A | B | C | D | E | F |
-------------------------
1 |....| * |.........| 7 |...
-------------------------
2 |....................| 2 |...
-------------------------
3 |....| * |.........| 6 |...
-------------------------
4 |....................| 1 |...
-------------------------
5 |....| * |.........| 5 |...
-------------------------
6 |....................| ? |...
-------------------------

? = average of B1,B3,B5 where (N = 3) and (specified column to the left = B)

## Weighted Average / Dynamic Range / Conditional Dashboard

Mar 27, 2014

The drivers are simply a start date and an end date.

For example: 1/1/2014 - 3/31/2014

To keep it simple I am only looking at 4 fields in the referneced data set. They are Date, Net Calls, Average Handle Time and Agent.

So records look as follows:

DATE AGENT NET CALLS AVERAGE HANDLE TIME
1/1/2014 Agent 1 30 Net Calls 2.00 Minutes
1/1/2014 Agent 2 40 Net Calls 8.00 Minutes
1/2/2014 Agent 2 05 Net Calls 25.00 Minutes
...etc

I am stuck on the Average Handle Time problem as this needs to be weighted on net call volume contribution by agent conditional on dates being equal to or greater than the start date and less than or equal to the end date.

I have attached a workbook for reference : Dashboard Table miacg.xlsx‎

## Calculating Average In For Variable Last Row And Copying Across Another Dynamic Range

Apr 28, 2014

I'm trying to calculate the average for a range that begins with cell B15 and has various end points, depending on the day (since I'm pulling 2 actual years of data that strips weekends and holidays, as opposed to going back a set amount of days/years). Syntax for cell B4 to reflect the average of range B15 to LastRow? I tried several things and it didn't work. Rows 1-12 are being reserved for the summary calculations that will then be pulled into the final Dashboard.

## Formula For Getting Average Of Values Without Counting Zero Values In Range?

Dec 23, 2011

Is there a formula that would allow you to take the average of all values within a range but not count the zero values? I thought something like this might work but it's not. Neither one worked.

=AVERAGEIF(\$E\$4:\$E\$34,">0")
=AVERAGEIF(E4:E34,">0")

## Formula To Average Range Of Cells And Copying It To Calculate Next Range Of Cells?

Mar 17, 2014

I have a row data corresponding to the measuring of load cell per min and I need to average the values per hour. So I have a column B for the date (from 1-01-2013 to 31-01-2013, column C for the time (0:00:00 to 23:59:00), and D de values per min I want to average. I have to do the same for the rest of the month of 2013 (February, ...., December).

I would like to know if there is a way to create a formula to calculate the average of the first 60 values (to get the average of the first hour of 1-01-2013), and then copy it to get the average of the following 60 (average of the second hour in 1-01-2013) and so on.

If there is no way to do it, I would like to know if I can do it using functions like average, match, index, offset, what would be the best match of those functions.

I also tried it by doing the analysis in another tab and using the function "averageifs" with two criterias: one for the date (example 01-01-2013) and another one for the hour (example 0:00:00), but it didnt work, it show error: #value. I inserted an extra column in the data tab with just the hour (example 0:00:00) in front of the corresponding column with (example 0:01:00, 00:02:00, etc)
Equation I used for this:

=AVERAGEIFS('Data (min)'!D\$6:D\$43206,'Data (min)'!\$A\$6:\$A\$44646,A6,'Data (min)'!\$B\$6:\$B\$44646,B6)
=AVERAGEIFS(TAB AND COLUMN WHERE THE RAW DATA IS,RANGE OF CRITERIA 1,CRITERIA 1,RANGE CRITERIA 2,CRITERIA 2)

## Macro To Leave The Values In A Range Of Cells

Nov 20, 2009

I need a macro to leave the values in a range of cells.

The macro needs to work on which ever cell is high lighted

For example if I high light cell G8 it needs to leave the value

in cell G8 to G24 then
in cell G29 to G45 then
in cell G50 to G66 etc

all the way down to the last cell range G1142 to G1158

## Macro To Check If Range Of Cells Values Are Balnk.

Jan 8, 2009

I am looking for a macro that will check 2 things....then do something.
The first is if a range of cell values in are blank. lets say
Sheets("Sheet1").Range("D6:G48").

Next is if a particular cell contains a given value ,
Sheets("sheet1").Range("E5") should equal "Year 1" if true.

If both these are true then I want the macro to copy a range of cells from
Sheets("Sheet2").Range("H6:H48") to Sheets("Sheet1").Range("D6:D48").

I tried to use IsEmpty but it seems to return a "False" if a range of cells
are being tested.

## Dynamic Named Range Sort Including Cells Outside Defined Range

Apr 3, 2008

Im sorting a dynamic range as mentioned in this Sorting a Named Range. My range is called drWarningTypes and is defined as:

=OFFSET(DataSource!\$A\$2,0,0, COUNTA(DataSource!\$A:\$A)-1,1)

When there is only one cell in the range, then running the following sort function includes A1 also in the search (and also adjoining columns).....

## VBA To Get Average Of Range Of Cells Based On Named Range In Different Column

Apr 10, 2013

I am trying to calculate some averages. What I have is 3 columns of data in A, B, C, also the "tasks" in A are in named ranges ex: "Award Contract" is a named range - "Task_Award" and "Confirm Updates" is a named range - "Task_Updates". I've attached a sample excel sheet.

I'd like to be able to create a macro to evaluate column A, and for every row in range "Task_Award", give me the average of the corresponding cells in column C and put it in the same range of cells in column B , then, for every row in "Task_Confirm" then give me the average of the same range of cells in column C and place the result in the same range of cells in column B. This is my very first post so I hope I am doing this correctly. I have 77 of these task ranges to evaluate and it will take a long time to do it manually. I'm thinking of a loop function.

## Set Dynamic Range Based On Values

Jul 20, 2009

I would like to create a dynamic range based on a cell value. However, the cell reference may vary because the numbers of entries in the workbook can vary.

In addition to that, after the first range (eg. A1:A10), I would like to create a second range after the first (eg. A11:A20).

## Get Values From Dynamic Named Range With VBA

Feb 7, 2013

How can I retrieve the values from a dynamic named range with VBA?

Let's say we have created a dynamic list with the OFFSET function, how can I get the values of that dynamic range?

## Average Out Range Of Cells Excluding Text Found In Other Cells

Jul 17, 2014

What I want to do is Average out a range of cells "F4:F343". That's the easy part =average(F4:F343). However I want to exclude any numbers for that average if data in coloumn "Q" = "FMC"

Would that look anything like:

=average(F4:F343)/countif(Q4:Q343, "<>FMC")

I'm also displaying it as minutes in a day so i added *24*60 to the end of the formula and formatted to Number/.00. I've entered the formula and it will calculate but when i enter FMC to the appropriate area the average wont change.

## IF Formula - Get Average Of Only Values In That Range Not Including Blanks

Nov 21, 2011

I am looking for a formula for the following:

If there is nothing is U6:W6 return blank

Otherwise sum the contents of Bf6:BH6 and divide by the number of cells that are not empty in the range U6:W6 (to get an average of only the values in that range not including blanks).

## Average Of Every N Cells With Overlapping Values

May 29, 2014

I need to get the average of every 6 cells, but the first value of each group of 6 is the last of the previous group. I'd also like the output to be displayed beside the last value in each group. i.e.

CELL B7 =AVERAGE(A2:A7)
CELL B12 =AVERAGE(A7:A12)
CELL B17 =AVERAGE(A12:A17)
etc.

I saw this "=AVERAGE(OFFSET(A\$1,(ROW()-ROW(B\$1))*10,,10,))" in another post which seems similar but how to modify it.

## VBA Average Calculation Of The Values In Cells

Jan 23, 2007

In my Case Else, I have it set to take the Average of the values in cells M8 for all sheets other than the ones listed in my other Cases, same for M9, etc. for each worksheet I have.

The change I want to make is as follows: I'd like it say say if the value in Cell M8 is the same on all sheets then place x value in cell M8 on the active sheet, same for M9, on so on and so forth. Only if the values in Cell M8 for each sheet are not the same then take the average.

Private Sub CommandButton1_Click()

Dim sh As Worksheet, sum As Double, n As Long
n = 0
sum = 0
Dim arr() As Variant
Dim nbrOfAvgs As Long, i As Long
nbrOfAvgs = 19
i = 0 ....................

## Finding Highest And Lowest Values In Dynamic Range?

Dec 28, 2011

I have a column that updates automatically by placing a value in in the next blank cell in the column. I am trying to write two formulas to identify the highest and lowest values in the preceding 10 cells of each update in the column but seem to be stuck in MIN/MAX/OFFSET hell.

## Sum Specific Range Of Values Between Two Headers In Several Dynamic Sheets?

Jul 16, 2014

I need to sum a specific range of values between two headers in several dynamic sheets. The values in the sheets always starts in row 10 and column H (Forcast). For example the header could be "Sales" in column A. Then I want to sum values above the header "Sales" in forcast column H. The next header could be "Operations", where I want to sum the values between "Sales" and "Operations" in column H. Next header could be "Rents" then I want to sum the values between "Operations" and "Rents" in column H, and this is how it continues... Is there any macros for this?

## Referencing Cells With Dynamic Row Values?

Mar 2, 2014

I'm trying to reference text from one worksheet to another. The data is all in column A on the "Template" worksheet, however the row varies (ie starts at row 5, then 7 the 9 etc). The cell row is always +2 rows on the previous row, and column A.

What can I use to pull across the cells with the information that I want, onto the "Report" worksheet?

## Calculate Average For Values In Range Of Data That Fulfill Certain Condition

May 20, 2014

I am trying to calculate average for values in a range of data that fulfill a certain condition viz. >1000 &

## Copying Range Of Cells Under A Dynamic Range Of Cells

Jul 30, 2006

I got a range of data on sheet2, size changes everyday (dynamic) And in sheet1. I got a range of data and the size changes everyday as well. I need to copy the range in sheet2 to sheet1. The position would be at the cell after the last data in sheet1. e.g.

sheet1 got 105 data
I need to paste data of sheet2 start of row106 in sheet1

## Average Of List Of Cells VLOOKUP Values?

Jun 20, 2014

I need to find the average of a list of text cells. My list is in column A, and in column B I've assigned each of the text cells with a numeric value. I'm then doing the average on Column B which will return a numeric value which will represent one of the text values in column A.

My average formula then looks like this:

=VLOOKUP(ROUND(AVERAGE(B2:B48),1),\$G\$2:\$H\$25,2,FALSE)

Can do this without using the helper column B and do an average formula using a VLOOKUP?

## Average Of Last 5 Values But To Exclude Any Blank Cells

Jul 3, 2014

I have a scenario where I have a rolling list of sales figures which get added to each week that passes.

I need a formula that will calculate the last 5 weeks of sales and generate an average - which I think I have an idea how to do.

The sticking point is that so as not to skew the averages, when there has been an exceptionally busy or quiet day for a reason we know about I exclude the sales from that week.

This then interferes with the averages as it either takes it as a zero and lowers it or seems to stop formulas from working.

So to summarise:

Average of last 5 weeks sales
Excluding any blanks
Dynamic enough to always pick up the last 5 values in the list (i.e. the last 5 weeks)

## Dynamic Range - Array Formula That Provide Highest Values

Jun 22, 2012

I've am array formula that I use to provide highest values:

Code:

{=INDEX(Data!\$D\$2:\$D\$128, MIN(IF(LARGE(Data!\$D\$2:\$D\$128,ROW(A1))
=Data!\$D\$2:\$D\$128, ROW(Data!\$D\$2:\$D\$128)-MIN(ROW(Data!\$D\$2:\$D\$128))+1)),
MATCH(LARGE(Data!\$D\$2:\$D\$128,ROW(A1)), INDEX(Data!\$D\$2:\$D\$128,
MIN(IF(LARGE(Data!\$D\$2:\$D\$128,ROW(A1))=Data!\$D\$2:\$D\$128, ROW(Data!\$D\$2:\$D\$128)-
MIN(ROW(Data!\$D\$2:\$D\$128))+1)), , 1), 0), 1)}

I want to replace the range Data!\$D\$2:\$D\$128 with a dynamic reference: like that one:

Code:
ADDRESS(MATCH(Summary!\$B\$1,Data!\$Q\$2:\$Q\$10000,0)+1,
MATCH(Summary!\$B\$7,Data!1:1,0),1,1,"Data")&":"&ADDRESS(
MATCH(Summary!\$B\$1,Data!\$Q\$2:\$Q\$10000,0)+COUNTIF(Data!\$Q\$2:\$Q\$10000,Summary!\$B\$1),
MATCH(Summary!\$B\$7,Data!1:1,0),1,1,"Data")

The two formulas work well in separate sheets but crash when put together, how could I possibly insert the second address formula into the first one?

## Dynamic Range In A Macro

Nov 17, 2011

I am trying wihout suceess to create a range to copy in a macro each time the macro loops. This is thus a dynamic range. My failed attempt is listed below. How is this done?

ColumnAdjust=2
For I = 1 To 282
Range ("B5").Select
Range(ActiveCellOffset(0,ColumnAdjust),ActiveCellOffset (0,ColumnAdjust+1))
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
.
.
.
ColumnAdjust= ColumnAdjust=2
Next I

## Dynamic Range In Macro

May 28, 2007

I am attempting to create a dynamic range within a macro.

Each week, a list of performance factors is recorded for employees. The macro is about to do an Advanced Filter to create reports based on user-provided criteria. Since there is new data every week, the range used for the Advanced Filter is dynamic. The code for the Advanced Filter refers to a range entitled �Database.� My problem is in defining �Database.�

It is currently 534 rows and 8 columns, starting at A1.

The relevant portion of the macro currently reads:

Sub Check1()

ActiveWorkbook.Names.Add Name:="Database", RefersToR1C1:= _
"=OFFSET('Loan Officer History'!\$A\$1,0,0, COUNTA('Loan Officer History'!\$A:\$A),8)"

Range(Database).AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
"J1:Q2"), CopyToRange:=Range("J5:Q5"), Unique:=False

End Sub

When running the macro, the debugger stops at the line which starts "ActiveWorkbook.Names" and tells me �Run-time error �1004�. The formula you typed contains an error.�

## Find Average Of Absolute Values Of Visible Cells

Apr 20, 2013

I am trying to calculate the average of the absolute values of a range of visible cells. I use filters to extract the data rows I need from a large spreadsheet. Then I need to calculate statistics on the resulting data, i.e. the visible cells. The line I am using to calculate this is:

VB:

ThisWorkbook.Sheets("Tracker Channel Stats").Cells(newRow, 4).Value = WorksheetFunction.Average(Abs(R.SpecialCells(xlCellTypeVisible)))

However, what I get back is simply the value of the first visible cell in the range, i.e. the average of the absolute value of one number is that number. how to make this work

## Formula To Average Cells In A Range

Nov 13, 2008

There are words in a cell and to its right is a number.

I have a name in P5. I need a formula in Q5 to add all the numbers
next to the same name in Range B4:O46.

Michael

Copyrights 2005-15 www.BigResource.com, All rights reserved