I've set up a Named Range that refers to an array of constants, e.g. MyRange ={1,2,3,4,5}. This appears to be fine since I can output the named range to a range of cells in a row (e.g. A1:E1) and see 1,2,3,4,5 (one value in each column).
I'd like to use MyRange as the source for a Data Validation list in a cell.
Normally data validation list sources must be vertical, so I've set MyRange =TRANSPOSE({1,2,3,4,5}). This appears to be fine since I can output the named range to a range of cells in a column (e.g. A1:A5) and see 1,2,3,4,5 (one value in each row).
When I set MyRange as the source for data validation however, it resolves to an error.
why this setup doesn't work?
Workbook detailing the problem attached. Attachment 273788 NamedRangeDataValidationArrayConstansts.xlsx
The range changes each month so I want to use a named cell "LastRow" where I can change the number to replace the 2500. How do I use the range name in my formula without giving me a #value# error?
I have a function in VBA of the type. Function MyFunc(Indx As Integer, k As Long, Rho As Range, A As Range) As Variant .... End Function
which is called as a user-defined function from within the Excel worksheet. When called with the last two arguments being a range (i.e. Result = MyFunc(1,98,A1:A2, B1:B2)) it works fine. However, when I try to directly use an array constant instead of a range (i.e. Result = MyFunc(1,98,{10,11}, {20,30}), it returns a #VALUE error.
I thought I could fix it by redefining the last two arguments as arrays of type double, but this didn't work either (i.e. Function MyFunc(Indx As Integer, k As Long, Rho() As Double, A() As Double) As Variant .... End Function ).
Most of the methods used for returning the sheet name are quite cumbersome. "=MID(CELL("filename",A1), FIND("]",CELL("filename",A1))+1,256)" takes up a lot of space in a larger formula.
Is it possible, please, to create a Name which returns the sheet name? For example I could write "=ThisSheet" and it would return the name of the sheet.
Of course I could resort to a UDF, but I wondered if it could be done directly in Excel.
When I try to insert the formula "=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,256)" into a Name, Excel helpfully converts A1 to "'Sheet1'!A1". So "=ThisSheet" in Sheet2 returns "Sheet1".
If I make the sheet name part of the Name, as in "'Sheet1'!ThisSheet, it works OK, but has to be added for each new sheet (though it works if an old sheet is copied).
Is it possible to use a contstant array in Excel VBA? I have tried several differnt ways to declare it, but the VBA editor keeps yelling at me. The following did not work:
I need to convert a cell that has a list of values A1 = 1,2,3. To a range expression {1;2;3}. I want to do this with a formula and not VBA. Example: Cell D1 has the formula = SUMPRODUCT(COUNTIF(C30:C31,A30:A32),B30:B32). I want to put the list range from column C into one cell.
I have the following array function that I am trying to get to work properly:
ActiveCell.FormulaArray = "=SUM(IF(NCR!O2:O100=39326,NCR!Q2:Q100,0))" 39326 is the value of 9/1/2007, and this formula works properly.
I am looking for a way to use this formula but replace 39326 with whatever date is in the first row of the same column as the active cell when it is run.
That is, if the macro was run with cell B8 as the active cell, "39326" would be replaced with whatever value was in cell B1.
I have a userForm (Form1) that contains a persons name that I would like to reference in a separate UserForm (Form2). In the separate UserForm (Form2) I need to reference this persons name many times, so I was wondering if there was a was to declare this name in the separate UserForm (Form2) as a constant. Only thing is that a constant, to the best of my knowledge, must be an expression and not a variable. Mainly, I'm trying to avoid declaring the myName variable in each Sub within Form2, which it will be needed for a ton of Sub's.
Code for Form2: Const myName As String = Form1.txtName.Value
I have 570 records in one sheet and 330 on the other one. They are the same data and I want to match them but i have been doing so manually because in the one w/ 330 there are missing values, so I have been copying and pasting but takes too long. The 570 is complete, i took it from the census data and the 330 is not.
I want to be able to match them in the same row including missing values so I can use it in ArcGIS
I have tried to match w/ the match function but have not had luck...
I have a spreadsheet that consists of 981 rows and 1152 columns (192 * 6). It is essentially 981 rows by 192 columns rectangles (if we think of it as a range) side by side. What I want to be able to do is cut 981 rows by 192 columns at a time and paste at the bottom of the first rectangle so forth so on.
Essentially currently data sets look like 1 2 3 4 5 6 - I want the cut paste process to move these rectangles to:
I have 20 worksheets that each have a 4-week training block for a University Athletic Program. Each worksheet has 5 named ranges for days of the week. The sheet for Block 1 has the named ranges: B1M, B1T, B1W, B1TH and B1F. From a Summary sheet, I have VLOOKUP formulas that each look in 1 specific named range. I have to insert the Name in thousands of formulas so I have listed the names in a column in the Summary sheet and then referenced the cell with Indirect from in the formula. Example B1M in cell C3 would have Indirect(C3) in the formula, but this causes the formula to become volatile and the workbook calculates very slowly. Is there a way to format the name in C3 or reference it in the formula so that it is not volatile?
I know I've asked before but I can neither find my previous question or the answer. So, once again.... is it possible to refer to a named range in a CSE array formula? I know how I would type a formula that way -- but I would be happy to see an example.
Most importantly, will it always work? Or are there pitfalls and dangers?
I am working on data that needs to be cleansed of the symbols i.e. *&/- etc so I am hoping that I can automate this as their are over 30,000 rows of data and takes time to go through each find and replace.
I am trying to find the cell in the named row "Ann_TaylorRegularBust" that is closest to the input bust size in cell B4. This formula works when I use actual range instead of the named array.
I have four named ranges (Segment, Keyword, Impressions and Dropdown) and I would like to create a formula-based ranking of keywords by impressions and clicks. Using the following array formula, I am able to return the correct values for impressions or clicks:
{=LARGE(IF(Segment=DropDown,Impressions),$H7)} where $H7 is the number ranking 1, 2, 3 etc.
My question is what array formula could be used to find which row in the array returned that number and then pulls the data from the same row in the other named ranges?
Essentially find row of {=LARGE(IF(Segment=DropDown,Impressions),$H7)} but return Keyword and Clicks on that row.
Other Notes: I cannot use pivot tables and some values might be the same which would make Vlookups not accurate for duplicate values.
Link to an example document to clarify this. [URL] .......
I am trying to enter only the named ranges in the active worksheet into an Array. The amount of named ranges can be from 4 to 7 per sheet.
I'm self taught at VB (This posts on this forum have taught me - thank you!) and have got the below code working on a Workbook - but not on a worksheet level. ActiveSheet.Names.Count returns nothing, changing to ThisWorkBook.Names.Count returns the sum of all .Names in the workbook.
Sub aTest() Dim sArray() As String Dim sJoin As String Dim y As Long
x = 1 y = ActiveSheet.Names.Count z = ActiveSheet.Name
I have a set of four pivot tables on a sheet that I need to programmatically change a Report Filter (Page Field) so I can create sets of reports in an automated fashion. This will be the first step in that process. The change will involve choosing > 1 Role each time the code loops through based on Named Ranges I've defined that are associated with that Role.
My code thus far:
Code: Sub TestCode() Dim pt As PivotTable Dim pf As PivotField Dim pi As PivotItem
[Code]....
emm_dc_gsr is one of many Named Ranges that will contain a variable number of elements. Just using the one right now to see if I can get the code to work, I'll eventually make another Named Range/Array of all them so I can loop through each Report ("ReportPick").
I want the Report Filter to consult that Named Range for its values and apply those values to PivotField "Role" that is used as a Report Filter.
When running this code above, I get a "Role" Field that says "All" but no values (the table is completely blank), with no evidence as to why it'd be blank (all filters in every Report, Column and Row are working normally and are filled in). When I choose a value manually after the code is run, the pivot table values populate. Do I need to somehow index the Named Range in that loop? I'm just confused about this step right here:
For Each pi In pf.PivotItems If pi.Value = RolePick Then pi.Visible = True Else: pi.Value = False
When I've run other versions of the code, I've gotten an array version of it to "work" using LBound and UBound, but it never chooses the right two values even though those are verified as stored in the array via a pass-through. It chooses the first few values in the Report Filter.
Here's the corresponding code for that:
For i = LBound(myArray) To UBound(myArray) pf.PivotItems(i).Name = myArray(i, 1).Value pf.PivotItems(i).Visible = True Next
I do not care if I use an array or a Named Range. I just want something that is simple and works. Passing the values directly from the named range seems easiest to my brain, but I'm open to anything and I'm clearly missing something (probably silly).
I also have no idea why " .AutoSort xlManual, .SourceName, .EnableMultiplePageItems" is necessary though every piece of sample code I've seen seems to have some variation of it.
While $ are constants for cells what is the symbol for variables? I guess when I dragged a formula down rows a certain number did not increase so I had to manually up each one as I went down the rows.
In my company we have many spreadsheets with sections that contain formulas, which may be overwritten with "hard coding", manually entered constants, in certain situations.
Is there a way I can detect the differences between the two types of cells? I would like to setup conditional formatting that would highlight constants in a table that would generally only contains formulas.