# Countif- Use A Named Criteria As Well As A Named Range

Oct 25, 2009

if I can use a named criteria as well as a named range. In essence what I am looking to do is count certain cells that meet the criteria in a certain named named range,

## Countif Criteria With Named Reference

Sep 28, 2006

I'm trying to use a countif formula with a named reference but the formula is not calculated correctly. My example would be: countif(A1:A5,<max) with max being the named reference. I also tried various options using quotes around the named reference (ex. "<max") but that doesn't work either

## COUNTIF On Named Range

Feb 15, 2010

When I apply the countif function to a named data range, it evaluates to #VALUE. I'm trying to count the number of entries in the range (Belgium.Data) that are strictly greater than zero, to calculate a y.t.d. average that won't be biased by incomplete data. The range-name is well-defined - the arithmetic functions like sum, sumproduct etc work and evaluate correctly across the range, but countif always refuses to return a value. I've also tried

"=COUNT(Belgium.Data>0)"

to no avail, as well as all the following:

"=COUNTIF(Belgium.Data,">"&0)";
"=COUNTIF(Belgium.Data,">0")";
"=SUM(Belgium.Data>0)".

Even the last didn't evaluate, even though "=SUM(Belgium.Data)" evaluates correctly. I can't seem to use the actual cell-references either, since the range is non-contiguous - I miss out every 11th cell to compute an average on the last 11 cells - and Excel doesn't seem to like the comma ("union") operator, insisting the 2nd component of the union is COUNTIF's "criteria" argument.

## Named Ranges On Multiple Sheets With The Same Named Range & I Cant Figure Out How To Do This

Jun 2, 2006

I need to create a named range on multiple sheets with the same named range & i cant figure out how to do this. EG :- I want to create a named range called "_SubUnitRows" on sheet1 starting from "A1:A50" & other named range again called "_SubUnitRows" on Sheet2 starting from "A1:A25" ...

## Combine Two Named Ranges Into 3rd Named Range

Mar 14, 2013

Merge two columns into one list in excel

I would like to combine List1 and List2 into a 3rd named range called List3. I was wondering if this were possible without using any additional cells/columns (i.e. I don't want to use Column C like in the example shown in the link above).

Here's the formula from the example:

Code:

=IFERROR(INDEX(List1,ROWS(C1:\$C\$1)),IFERROR(INDEX(List2,ROWS(C1:\$C\$1)-ROWS(List1)),""))

I've played around with it, but could not come with any that worked.

## Determining If Cell Is Part Of Named Range And What That Named Range Is?

Aug 16, 2014

Let's say you have a named range, Rng1, which consists of cells A1 & A2. In vba how would you report back what, if any, named range the following cells resides:

Code] .....

here are multiple named ranges so using intersect is not feasible. Essentially, through code, I will be given a range and I need to determine if that range if part of a named range.

## Build Dynamic Named Range From Criteria

Jan 14, 2013

I have some raw data, and in that data are 2 columns. They are Manager and Role. I am trying to create 2 lists, that correspond to their role. I can create a dynamic named range from the column no problem using this formula:

Formula:

[Code] .....

Now, what I need to be able to do is, add a criteria option to the formula. So build the list off of column B, but only if their role (in column C) is Perm, or Temp.

See the attached spreadsheet : dynamic range criteria.xlsxâ€Ž

## Defining Named Range, Error Criteria

Apr 13, 2007

I am trying to define a dynamic range based upon error criteria. After the first error, all the subsequent cells are filled with the error and I would like to limit the named range to the rows with no errors (one column wide). I am thinking something similar to (realizing this is probably very wrong):

=OFFSET( 'Basin Routing'!\$X\$5,0,0, COUNTIF('Basin Routing'!\$X:\$X,AND(NOT(ISBLANK()),NOT(ISERROR()))),1)

## Data Validation List With Criteria Using Named Range

Oct 30, 2012

I have been tasked with creating a data validation list. My data is contained on a separate sheet from my data validation list. I am using a named range to use the data for my data validation list. However, I am looking to add a criteria to my data validation list so that it only is populated with values based on another column on my data sheet.

For example, if I have a data sheet called "Employee" and I have two columns. Column A is a list of employee names and I have named a range in column A as "EmployeeName". Column B is used to define the category of employee. This value is a letter, for example, "A", "B", "C", or "D". This column does not have a named range as I don't know if I need one to get this to work.

I would like the data validation on one sheet to use a list of employees of a particular class from another sheet. Straight forward validation is easy using a validation list with a formula =EmployeeName. But how do I only list employees that have a category "A"? For some reason, I cannot get some of the formulas I have found while searching this message board to work.

## Making Named Range The Last Active Value Used Within Another Named Range?

Jul 19, 2013

I'm trying to make my named ranges remember the values of the last active cells used within another named range. The purpose of this is to make my charts dynamically change dependant on two criteria selected. My spreadsheet currently updates itself as and when I change the active cell within a single named range, dynamically changing the chart data by using Lookup based on the active cells value. However I want to get away from having several charts showing, I would like to have a single chart which dynamically changes based on a second selection. So the first selection is for a department (Facility) which changes the chart data relevant to that department, the second selection is to dynamically change the chart shown for the pre selected department.

Picture2.jpg

Using the following code when updating just one criteria with several charts

VB:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not Application.Intersect(ActiveCell, [MeasureType]) Is Nothing Then
[valMeasurePicked] = ActiveCell.Value [code].....

which works fine but I'm not sure how to add a second selection criteria because my code uses Activecell. I thought that the VBA needed to set the last used value of a range as a variable and therefore allow the second criteria to be selected but am not sure how to put it into practice.

## Sum Range Using 1 Column Of Named Range As Criteria

Dec 21, 2006

how to use SUM Formula a column from within a Named Ranges or Dynamic Named Range?
For example, if the range name "MyData" refers to the address: A1:G10, how could I sum all the numbers in column G of that range where column A meets certain criteria.

Eg., Column A holds fruit names:
Apple
Orange
Banana
Apple

and column G holds quantities of the particular fruit. I'd like to sum column G (quantity) for only those quantities that match "Apple" in column A.

## Copy/Paste Cell To Named Range Named In Adjacent Cell

Sep 4, 2007

I have read post re this question but have not been able to answer my problem. I get the error message 'Application defined or object defined error' when running the code below. I should indicate the range counter currently indicated about 6,200 rows that this code will work on and the individual range names in the list of 6,200 rows are spread over at least 20 worksheets.

The code appears to be running but after some time it stops on the line of code 'Range(Cells(i, 1).Value) = Cells(i, 2)'.

Sub PopulateWithImportData()
Dim counter As Integer
counter = Sheets("Imported Data").Range("Counter")

Application. ScreenUpdating = False
Application.Calculation = xlCalculationManual
Worksheets("imported data").Select
Range("a1").Select

i = 1
Do Until i = counter
Range(Cells(i, 1).Value) = Cells(i, 2)
i = i + 1
Loop

## COUNTIF, INDIRECT And Dynamic Named Ranges

Nov 22, 2006

The following formula produces the desired result:

=COUNTIF(INDIRECT(TEXT(A8,"mmm")&"!B2:Z100"),"SK")
but replacing the range of cells with a dynamic named range returns #REF!:

=COUNTIF(INDIRECT(TEXT(A8,"mmm")&"!Data"),"SK")
where A8 is the date 01/01/07. I'm trying to count items within the range Jan!Data.

I'm not sure if I'm trying to do the impossible, or if I'm missing something.

## Mastersheet - Auto Input Named Rows Onto Other Named Sheets

Apr 1, 2014

I have a master sheet and 102 'advisor named sheets'. The master sheet is updated daily with information (number and text) along 1 row in different columns (A:W). I would like when the advisors name is typed (W) =joebloggs! for this whole row to be auto input on joebloggs sheet. There can be multiple of these entered daily for same person, so the information would need to populate on the next row so not to type over the previous entry.

## Copy Worksheet Data By Condition/Criteria To Respective Named Sheets

Jun 2, 2008

Now what I am looking to do is search my spreadsheet for specific criteria and then copy and paste these rows of information to a new sheet.

In my first spreadsheet that I am using as a database, I want to be able to select any entry from the month and copy it to another spreadsheet named for that criteria.

In other words, I want to find every entry for January, copy just that data's rows and paste them to the January spreadsheet, February to February, etc. My date fields are in column A.

I also want to do the same with representatives names found in column B.

This will break down the data for each rep and each month. Using the filter, then copy and pasting would be cumbersome.

## Named Range

Jan 3, 2009

can i sort a named range alphabetically?

## Use A Named Range In VBA

Dec 12, 2009

In the following code I am able to use the Range "J46" successfully but I have tried to refer to a named variable/range that has the same info as J46 (LongestGL) and then it gives the error that you see below the code.

Private Sub Worksheet_Calculate()
If Range("J46").Value > 36 Then msgbox "The combination of Width, Height, and Pitch that you have entered results in at least one post length that is more than 36 feet long. You will need to juggle these parameters until you no longer get this message.", vbExclamation

End Sub
Private Sub Worksheet_Calculate()
If Range("LongestGL").Value > 36 Then msgbox "The combination of Width, Height, and Pitch that you have entered results in at least one post length that is more than 36 feet long. You will need to juggle these parameters until you no longer get this message.", vbExclamation

End Sub
Error Message:

Runtime error '1004'
Method 'Range' of object '_Worksheet' Failed

The only thing changed was the Reference "J46" to "LongestGL".

## Named Range Value

Sep 16, 2006

I have a worksheet named range, reghoursworked, with the value of 8. What is the vba code to return this value? y=range("reghoursworked").value??? (works with other named ranges)

## Last Used Row In Named Range

Jul 7, 2007

I have a named range (name is IncidentList, the actual range is A5:H500) that I'm trying to find the last used row in, then apply a border to the left and right of the row (eg: apply a border to the left of A1 and the right of H1). Normally I would just find the last used cell in column A, apply a border to the left, then find the last used cell in column H and apply a border to the right. The difficulty I'm having is that column H will not always have a value, so selecting the last used cell in column H may not necessarily take me to the last cell within the range
I've tried something like:

Range("IncidentList").Select
Range(Selection, Selection.End(xlUp)).Select

## Add SUM To End Of Named Range To Sum Named Range

Mar 26, 2008

I have a formula copied into a named cell “Dest1”. This cell is based on value in cell “X4”.

Set Dest1 = Range("C1").Offset(Range("X4").Value + 1)
A “Do” loop copies the formula down, to a cell which I name “Dest2”.
Set Dest2 = ActiveCell

How do I sum from “Dest1” to “Dest2” with result in the next row down from “Dest2”?

## Find Matched Value In A Range For Named Cell Then Copy Range Cells Below

Aug 6, 2013

I need method, using a button, that looks at a cell--say EO2, for example--, looks back on a master worksheet at a specified row and range for a match, then looks at the information from a specified range below the matching cell (The information in this column will either be blank or have an "X" in the cell), and then those rows that do not have an "X" will be hidden in the corresponding rows in the working worksheet. Therefore, if at any time the value in "EO2" ever changes, then it will automatically find a new match and repopulate and hide information as before. About 130 columns will have its own button so that a "query" can be made that depends on the information in a particular cell in that column.

The master worksheet now has matrix of 287 rows and 58 columns. Each row is for an operating procedure and each column shows a job code. An "X" in a coordinate cell for a column/row shows whether that job code is responsible for knowing that operating procedure. So, on the working sheet, an employee's primary job code is given underneath his or her name. When the button is pushed, all the operating procedures not required for a given person will be hidden and only the required ones will remain visible--grouped, if you will. Qualification dates will be easier to see now that the information is consolidated. Whenever someone transfers to a new position, a new code will be inputed on the working sheet. When the button is pushed, a new grouping will result. Any operating instructions that overlap will still have qualification dates, so that information will not need to be transcribed.

## 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.

## Creating Named Range Taking Avg To Date Of Dynamic Range

Jul 15, 2014

I have a column of data that keeps getting new information in it. what i need is a named range that i can use for a chart, first point in the named range will be the first value in the column, second point will be avg. of point 1 and 2, then 3rd point will be avg. of 1,2,3 etc.

## Get The Range Address Of A Dynamically Named Range That Refers To A Formula In VBA

Aug 10, 2008

I have a named range that expands and contracts based upon the amount of data that is in some column. Call it AllData_UsedRange.

I have another named range that actually refers to a range. Call it AllData.

Column A
Row2 56
Row3 44
Row4 65

AllData is a named range that refers to the range A2:A65536
AllData_UsedRange refers to A2:A4 by way of this formula.
=OFFSET(AllData,0,0,COUNTA(AllData))

How to I obtain an address of AllData_UsedRange in VBA code?

These do not work...
Evaluate(ThisWorkbook.Names("AllData_UsedRange"))

## Stop Graph From Changing Named Range To Formula Range

Sep 8, 2006

I am trying to create a graph for a range of data that updates monthly (adding an extra month each time). I wanted the graph source data to update automatically each time the data is refreshed so used an OFFSET formula to identify a named range. I then point the graph to the named range as the source data.

When I enter the range as the source data the graph picks it up. However, when I re-enter the source data option on the graph it has converted the named range into a cell written range (ie. replaces "=QUALITY" with "='Front page'!\$B\$7:\$J\$10" - which therefore will not update when the range increases.

## VLookup Using Named Range

Jan 14, 2014

I am trying to do Vlookups across multiple sheets but cannot make it work. My result is #VALUE!

When I look at the Function Arguments it says the Table Array is Volatile.

My named range "Centers" has 19 tabs listed.

=VLOOKUP(A114,INDIRECT(""&Centers&"!A5:R395"),13,0)

## Averageifs Using A Named Range?

Jan 18, 2014

I have large data sheets were I need to calculate the average value only for certain team members performing certain service call types. There are several different teams involved. The results need to be displayed in a interactive dashboard were the user can choose the team to see that teams result.

So I need to build a formula that uses a named range that contains a list of team members. I don't want to use named ranges in the data sheet itself.

The data sheet has one row for each service call.

-Column A has the team member ie: 20TE01, 20TE15, 20TE78 ect ect.
-Column B has the service call type ie:, M, A, S, O, ect, ect.
-Column C has the value I need to average.

Named Range is "teamA" contains 20TE01 and 20TE15 as an example

I can use this to count the call type "M" by team as an example =SUMPRODUCT(COUNTIFS(A:A,teama,B:B,"M"))

What formula will provide me the average of a particular call type by team?

## Named Range Name Keeps Changing On Its Own?

Apr 22, 2014

I have a master workbook ("database") containing many named ranges (ex "Contact"). I have another workbook template ("estimate") that I rename for each project and it too has named ranges (ex "Contact") referring to the named ranges in "database" (ex =DataBase.xlsm!Contact). I am saving "database" on multiple PC's and syncing to the cloud (skydrive / onedrive) so that I can access "database" from multiple PC's. What I'm finding is everything works fine as long as "estimate" or whatever I've renamed it is opened on the same PC it was created on.

If I open estimate on another PC the named ranges in estimate are renamed by addition of a prefix including the complete path to "database" (ex "='C:UsersJasonSkyDriveDocumentsDaikinServiceToolsDataBase.xlsm'!Component"). This renaming prevents the named ranges in "estimate" from working on other pc's because this specific path doesn't exist on other PC's, only the PC it was created on. Is there a way to name the named ranges in estimate by only the workbook name (=DataBase.xlsm!Contact) without the entire path being automatically added as a prefix?

## Creating Named Range?

Aug 19, 2014

I'm trying to create 3 different named ranges which are of alternate cells in columns. Each column runs from row 3 to row 106 and each named range covers 5 columns. Therefore each named range needs to contain 260 cells (52 cells per column x 5 columns).

Apart from the fact that you can't deselect a sell by Ctrl+Right Clicking on it, making a selection of the relevant cells is proving impossible.

For example I carefully selected all 260 cells for my 1st named range and entered a name. However when I then go into Name Manager I see that loads of cells haven't been selected at all and instead some cells in some columns have been but with huge gaps between them. If I try to then add cells my Ctrl+Clicking on them I find that I can add some but then one of two things will happen. I'll either click on one cell, the same cell every time, that deselects everything and I have to start all over again or when I try to save the new range I get a message saying the formula is wrong.

I've also tried typing in the names of the cells manually but the same thing happens. Annoyingly I've manually created a formula with all the cells I need in Notepad but even though the option to Paste is there, it won't let me paste into the field!

Is there a limit to the number of cells you can have in a named range?

Is there way of editing the name range accurately?

Is there a better, easier way of selecting all the cells for a named range?

[Code]....