Performing Worksheet Functions On One Column Of A Two Dimensional Array?
Nov 19, 2009
I have an array with dimensions (5000,30). I want to perform a worksheet function "Percentile" on specific columns within the array. So for instance I may want to know the element falling at the 50th percentile in column 5 of the 30 column array. Is there a way to do this without having to place the array onto a worksheet?
View 4 Replies
ADVERTISEMENT
Nov 27, 2008
I've been a lurker on this forum for a long while and it's always been able to provide me with lots of excel tips, and for that I am grateful! But this time I have a question that I can't find the answer to here, or anywhere else on the web after a few hours of looking. As a note, I'm not very experienced with Excel, probably somewhere between novice and intermediate.
What I need to create is a 2-dimensional array of data. The vertical (y-axis) are the tools, and the horizontal (x-axis) are the jobs. Where the y-axis and the x-axis intersect, will be the quantity of tools needed for that specific job. There are almost 1500 tools, and 100 jobs.
View 4 Replies
View Related
Mar 13, 2009
I have a very large grid of data, about 400Rx200C, which contains a lot of blank fields. All of this data is currently in values from 0-100 representing percentages, but not formatted as such. I need to make all of these values into Excel Percentages so naturally used Paste Special and Divide from a field with the value 100 in it and then simply format the cells as %.
However, this fills in all of the original empty cells with a 0.000% which I do not want, I need them to stay blank. And some of the cells that do have values also have 0.000% so I cannot just delete all of these values with a VBA script. I had been hoping the Skip Blanks option would do this, but it does not unfortunately.
View 3 Replies
View Related
Nov 28, 2011
I'm new to arrays. They seem promising for what I want to do though...
Heres where I'm at. I have some data like this:
items freq 1 0.5 2 0.5 3 0.5 4 0.25 5 0.25 6 0.125
Now, I've created a 2 dimensional array, as such:
Code:
Sub testarray()
Dim arr1 As Variant
Dim rng1 As Range
Dim lngX As Long
Set rng1 = [A2:A6]
ReDim arr1(1 To rng1.Count, 1 To 2)
For lngX = 1 To rng1.Count
arr1(lngX, 1) = rng1.Cells(lngX, 1)
arr1(lngX, 2) = rng1.Cells(lngX, 2)
Next
End Sub
Now, what I need to do, is create an array for each freq of all the items that share that freq. Essentially I need this:
0.5 {1,2,3} 0.25 {4,5} 0.125 {6}
Now, I was thinking, if I could create a dictionary object and make the key the freq (so my keys would be 0.5,0.25,0.125) then I could assing the "item" an array (or another dictionary) holding the items that apply to that freq.
View 9 Replies
View Related
Jan 15, 2014
i have a sheet in template i use in preparing bid packages for electrical installations.it relates to locating in a (building) grid the locations of the motor control (mcp) and power panels (cdp).my desire at this point is to find a way to local a unique value (mcp or cdp) in a 2d grid and then return the column and row names from the same grid. eventually this information will populate a table of all the mcp's and cdp's with their locations.
my sticking point appears to be finding a unique value in a 2d table. this value can be anywhere in the table, not just the first column.
i've tried the lookups and index/match. match fails when i extend the lookup_array beyond the first column.
not sure if this is even possible.
View 8 Replies
View Related
Feb 14, 2007
With a known X and Y, trying to solve for Z from a table. ie: IF a variable X is defined across a row, another variable Y defined down a column, the data field Z fills in-between. What do I need to use to interpolate for both X and Y to solve for Z?
View 9 Replies
View Related
Feb 27, 2007
I am trying to write a public function that fills a table for a 2-dimensional array and am having trouble with my named ranges. The x-axis is based on years (range F2:O2) and the y-axis is a q_factor (range E3:E23) so the data range would be (F3:O23. The following outlines my logic:
Public Function bondValue(years As Range, q_factor As Range, z As Double)
Dim nRow As Long, nCol As Long
Dim bondPort As Range
nRow = q_factor.Rows.Count
nCol = years.Columns.Count
sumTau = 0
View 6 Replies
View Related
Nov 26, 2008
I have a spreadsheet which I will be adding to over time. I need a macro that will look for the last 10 rows and then pull together a summary table based on data from several of the columns on each of those rows.
I've tried to go about this by using an array. The array will always be the same size (it will always be 10 by 11, i.e. EngineArray(10,11)-basically the same size as my summary table). I've also set Option Base 1.
What I’ve got so far is below. It isn’t working properly though. To start with I was getting ‘type mismatch errors’. Now instead of reading the numbers from the selected cells into the array, it just changes all the cells I’m trying to read from to ‘TRUE’?
View 6 Replies
View Related
Dec 3, 2009
Filling all elements of a two dimensional array?. I know that I could write something like:
View 3 Replies
View Related
Apr 21, 2014
I have a dimensional array / matrix that is current a 9 by X, where x depends on the amount of entries a user makes.
Anyways my question is that I have a sheet called "Database" and I wanted to know if there was a simple code to transpose my array on that sheet starting at cell "A2".
View 3 Replies
View Related
May 15, 2007
I've created an array that is 60 pairs of cells wide. Each row in the array represents a different account. The 60 pairs of cells contain up to 60 payments in a payment stream. The first cell of each pair may contain an amount of interest to be paid, or zero if the time band in which it was/will be paid is not within the time range that I'm evaluating. The second cell of each pair may contain a number between 1 and 10 representing the time band in which the interest will be paid, or zero if the payment date falls outside of the time bands.
I need to be able to sum the interest to be paid in each time band for all of the accounts in my database.
Is there an Excel function that I could use or will I need to write some VBA code to loop through each row?
View 9 Replies
View Related
Oct 9, 2004
I can set up a 2 dimensional array by using
array = Workbooks("Workbook.xls").Worksheets("Data"). Range("D_all")
as range D-all contains 2 columns and 20 rows
I can send that list to a combo box by using
Me.ComboBox1.List() = array
If I have ColumnCount set to 2 then both columns will be listed
If I have ColumnCount set to 1 then the 1st part of the array will be listed
But how do I list just the 2nd part of the array
View 8 Replies
View Related
Jan 12, 2007
I am currently using a macro which highlights keywords and associated page views from an array in my website stats spreadsheet. Now I need to take it to the next level:
I want to use a multi-dimensional array to pull out any keywords that are duplicated, and display them at the top of my spreadsheet with the totaled page views next to them in a different color (red).
Here is my existing Keyword highlighting
Sub Highlight_Keywords()
Dim vntWords As Variant
Dim lngIndex As Long
Dim rngFind As Range
Dim strFirstAddress As String
Dim lngPos As Long
View 9 Replies
View Related
Sep 10, 2012
I had this code and it works like a charm, except, it crashed if the data gathered is just one element due to transpose ..
VB:
Function getAR(c1 As Range, c2 As Range, w As String) As Variant
Dim s As String
Dim arrTemp() As Variant
Dim arr() As Variant
[Code]......
View 5 Replies
View Related
Mar 30, 2012
What I'm trying to do:
1) I have data that has a header row of 6-10 values (created, action, type, id, ...). The rows are unique records.
Click here to see the data
2) I originally wanted to read the data into one array (DataArray) and the header into another array (KeyArray). Then I would add additional unique information about each record (additional columns of info) into the DataArray.
3) I stumbled upon Dictionaries as a way of storing key/item pairs, which I thought could apply to each record since the headers are all unique and would be a way of storing key/items without needing to:
a) Know the ordering (if I used arrays I had to know the upper bound of the array to insert a column
b) Look up which what position in the array mapped to which column header
c) Resize the array every time I wanted to insert a new column of information on all the records
4) So now that I know about a dictionary object, I believe I need to create one Dictionary object for EACH record (row) of my data and then store those Dictionary objects within a one dimensional array such that each element of the array is a Dictionary.
5) This way I can iterate through each element of the array to access the dictionary inside and perform calculations on each record, depending on which key/item I needed to work with at a later point
Questions for Dictionary experts:
1) Is my approach sound?
2) What is the syntax for putting the dictionary of one row's worth of data into an element of a one-dimensional array?
View 8 Replies
View Related
Sep 15, 2012
I'm trying to make this piece of code work to no avail yet... Every time I run it, the compiler pops up with Error #9: "Subscript out of range". The range consists of hundreds of cells in 1 column with geographic coordinates formatted as "General". Like this: myArr(38.91472, 37.20318, 38.63824, etc.). Tried to re-format the cells to "Number" - doesn't work either.
Code:
Sub searchArray()
Dim myArr() As Variant
Dim i As Integer
myArr = ThisWorkbook.Worksheets("Sheet1").Range("G1:G8594").Value
For i = LBound(myArr) To UBound(myArr)
Debug.Print myArr(i)
Next i
End Sub
View 2 Replies
View Related
Jun 2, 2013
I need to declare a two dimensional array that will return the Row and the cell's string value. My only solution is to return the row as a string like this.
Public GlobalArray(2, 100) As String
How to get more control than this? Maybe I should just declare it as a variant but this might open it up for problems later.
View 3 Replies
View Related
Apr 22, 2014
i'm trying to develop an array that is populated when a userform is activated. The userform has a command button that when pressed, will cross check the information filled out in the userform with the entries in the array. If there are no matches then the array is ReDim and the new information is added to the array. Once all the entries have been made. The array is then transposed to a sheet titled "Database". My problem is that vba is not allowing me declare a public array.Below is the first part of the code. Which is when the userform is activated.
Private Sub UserForm_Activate()
With Sheets("Resources")
cbZIP.List = .Range("A2", .Range("A" & Rows.Count).End(xlUp)).Value
cbBED.List = .Range("B2", .Range("B" & Rows.Count).End(xlUp)).Value
cbBATH.List = .Range("C2", .Range("C" & Rows.Count).End(xlUp)).Value
cbSTABRV.List = .Range("G2", .Range("G" & Rows.Count).End(xlUp)).Value
End With
[code]....
View 1 Replies
View Related
Feb 11, 2007
How can I assign values from a listbox to a twodimensional array?
and next
do something like search and remove a row and assign the array back to the listbox
I know I can do it directly, but I need the array for something else too
View 5 Replies
View Related
Apr 29, 2007
I have a big array "DataArray" and want to access it:
For i = 1 To 4
variable = DataArray(SourceArray(i))
Next i
"DataArray" has two dimensions, so SourceArray has to consist of data like this:
SourceArray(1) = 1,2
sourceArray(2) = 2,4
etc
What data type does Sourcearray have to be? Integer doesnt seem to work, and DataArray doesnt like a string as coordinates. I have a workaround with two different arrays of integer for x and y coordinates, but this cannot be it.
View 4 Replies
View Related
Jul 20, 2007
I searched and found a few posts about transposing arrays into a range of cells, but none of them seemed to solve my problem. So, my problem is, I have a .Net assembly which provides various functions to allow Excel to access our Oracle DB stored procedures/tables, etc. This assembly is exposed via COM Interop. I call the GetSPINTypes() method, which returns me a list of type pairs (ID, Name), in a CSV string format.
I split the CSV into rows, and then put each row into a 2-dimensional array.
I then need to dump that array into one of my sheets in Excel, so I try to do the usual Range.Value = Array, but this sometimes tells me there is a type mismatch, and most times just doesn't fill the range. I've checked my arrays in the watch window, and they have definitely been filled in correctly, the values just don't appear when they are put into the sheet. See the code I'm using below:......
View 4 Replies
View Related
Aug 18, 2007
I have made the function below to return a variant multidimensional array. I pass the function an array of folder paths that I wish to search through looking at subfolders within that path where their name matches a search string that I pass to the function. eg., it will find a folder named "Catnap" if you pass the string searching for as "Cat*".
The size of the array it builds depends on how many folders it finds that match the search string and so needs to be built dynamically. Hence, I believe it builds a 2 dimensional array horizontally and I transpose it at the end of the function. In each element I put the folder name that was found in the first dimension and the path to that folder in its second dimension.
I have a 2 column listbox on a form that I set this array to. eg., Me.ListBox1.List = DirPaths("C:","Cat*",vbDirectory,100)
This works fine and shows a list of folder items found by folder and path in the two columns of the listbox if there is greater than 1 search found. However, when the search only finds 1 then the listbox shows the folder name with the folder path in row 2 of the list box. (See below).....
View 2 Replies
View Related
Feb 26, 2008
I've got the folowing array's
date1>company1>price
>Company2>price
>company3>price
>enz
Date2>company1>price
>company2>price
>enz
enz.
But these are not the array's that i need for a correlation that i want to make.
Is it possible to transform the array's above to an array such as:
Company>date1>price
>date2>price
>date3>price
>enz
View 5 Replies
View Related
Feb 27, 2008
I'm trying to use VBA to do some matrix processing. I have successfully done matrix processing in the spreadsheet, but I'm looking to port the logic into VBA to more easily reuse central formulas and reduce the amount of code in the spreadsheet.
The function shown below works. I had to hack around the variable declarations to eliminate processing/compile errors but it seems to function (no pun intended).
While debugging I noticed that this function would seem to get called 4 times. I do have other modules running, although I don't think any other modules are affecting this.
After some input from shg, I updated the variable declarations, but I'm getting an "Overflow" error reported. Sometimes (not always) a divide by zero also pops up. I do have the Msgbox for errors at the end, I haven't tried removing that part to see if the error reporting vanishes. I'm not sure 'hiding' error alerts is the best thing to do anyway...
View 8 Replies
View Related
Apr 15, 2008
the built in "Join" function can join all elements of a 1-dimensional array into a string with delimiter. Now, how do I do that with multi-dimensional array if I just want to join 1 dimension of it.
For instance, I have:
m = 10
n = 20
Redim my(m, n)
'assign values to array here...
'I want to join, say, my(5, 0 to n) only
'How to do that without declaring a new 1 dimension array?
Also, I want to write a join sub/function to do the above for n-dimensional array, do I need to write each one for every number of dimension (1 sub for 2-dimension, 1 sub for 3 dimension, etc.)?
View 4 Replies
View Related
Jun 13, 2009
I occasionally see array and/or sumproduct formulas that incorporate symbols that I don't really understand in an array context.
These symbols include:
* (asterix)
| (vertbar)
. (period)
; (semicolon)
Also: are there other powerful symbols that have meaning in an array or sumproduct context?
View 3 Replies
View Related
Dec 9, 2008
I have a list of part #s that i need to group together and sort by their corresponding dates. The formula I've written does what I'd like it to do (assign a value to part groups that i can sort by first before sorting by the date) , but is too large/has too many nested functions to be applied. This formula is going to be used with multiple queries from a database that updates regularly.
EXAMPLE OF DATA(6000+ entries)
http://www.excelforum.com/attachment...1&d=1228860131
This is the breakdown of my formula, I've bolded the parts that aren't constant
=IF(AND(LEFT(D2,5)>="S2000"LEFT(D2,5)<"S2005"),1,IF(continues)...................
View 3 Replies
View Related
Apr 7, 2014
In sheet1 I have name(column A) and value(column B)
In sheet2 I have name (column C) and key(column D)
In sheet 3 I have results
Example ( It is just a total nonsense example, the real data is net inflow of some funds that are unique)
Sheet1
House 1000
Car 1500
pet 2000
Sheet 2
house1
car1
pet2
So in the sheet 3 I want to put a formula that is capable to sum all values of the sheet2 if the name has a key of 1in the sheet2, the key columns has values of 1 or 2
I think in SQL will be something with join and group by with having clause.
The result will be 2500 in the sheet 3.
What I tried: My attempt is to do something like this code ( using array functions).
View 7 Replies
View Related
Sep 15, 2012
What I am trying to do is to automatically build a "tree" diagram representing the links in a huge model which is dynamically configured. What I have a problem with is the following:
The tree consists of layers, I start off with the top layer and for each entry in the top layer I can add all its subsidiary layers and draw links between them, this uses a function which takes as its arguments the node name and its layer number (how far down the tree it is) and the number of items in that layer so far.
So I start at the first item in Layer 1 and there are as yet no layers below it. I start at the first one and add the first item in layer 2 then I kick the function off again and that adds the first item connected to item 1 in layer 2 in the layer below (3) starting at the first one, and so on. When I reach the bottom I go up one layer and add the second item in the bottom layer and so on. When I have added all the connctions to the first item in the next to bottom layer I go up one layer and add the second item connected to the first item in that layer and then add all the items connected to it and so on and so on.
In this way I build up the network exhaustively (to make things more complex more than one item in a layer may connect to the same item in the layer below).
I can do almost all that, the issue I am struggling with is I need to keep track of how many items there are in each layer (as some layer 1 items connect to 1, 2, 3 ...8 layer 2 items and so on). my idea is to keep a running total of these in an array LevelCount(1), LevelCount(2) etc. so when I add a new item to a layer I know where to put it. However I cant workout how to do this final step.
Currently I have a function that draws the nodes below a specified node this and takes the correct value from the array LevelCount(n) by passing Levelcount(n) (where n represents how far down the tree you are) into the function and the function then updates the value of LevelCount(n) (ByRef) so that next time I use it it is correct. That is fine but what I want to do is to is to call the same function from within itself when it adds each node which would make it work automatically - it would keep calling instances of the function until it reached bottom and then go back one step at a time to the top but I cant work out how to reference the right value in the array to pass into the second (and subsequent) instances of the function.
I don't think I can simply pass (n) into the function and in the body of the function set LevelCount(n) = LevelCount(n)+1
I also dont know ahead of time how many layers the model will have, nor can I tell which layer a node sits in as it depends on the links that are dynamically configured.
Beyond this a node can also be subsidiary to nodes in more than one level so it needs to sit at the lowest level - but I suspect if I can work out how to do the first bit i can do this too.
View 7 Replies
View Related
Dec 13, 2006
All I am doing is counting text values in a table.
The table has 3 main columns(which are relevant to this thread anyway).
Shift - Area - Status
The example I have attached shows examples of DCOUNTA, SUMPRODUCT and a Pivot Table.
I have read many threads stating that the best one to use is Pivot Table followed by DCOUNTA followed by SUMPRODUCT.
The most effective for me seems to be SUMPRODUCT (although this does slow excel down dramatically when you use a lot of these formulas). As do Array Formulas
The Pivot Table does not update on its own, therefore constantly needs to be refreshed. (I could use code to do this)
The DCOUNTA seems to be the least effective at doing what I want (unless I am doing something wrong)
In the attached example can the DCOUNTA be used more efficiently as I don't like the fact that I am duplicating rows to apply the criteria for a different shift. e.g
Area 1 - Late Shift - Banned
Area 1 - Early Shift - Banned
I want my table to be as follows (as the SUMPRODUCT shows)
AREA - Early Shift - Late Shift - Night Shift - Area Total
Area 1
Area 2
Area 3
Area 4
Area 5
Shift Total
View 4 Replies
View Related