Data Type Of Coordinates Of 2-dimensional Array
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 Complete Thread with Replies
Sponsored Links:
Related Forum Messages:
Creating A 2-dimensional Array From A 1-dimensional List
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 Replies!
View Related
Minimum Distance Calculation Of Geographic Coordinates Using Array
I am working on two spreadsheets, one we shall call Target Sheet and the other Reference Sheet. On the target sheet, I have a set of 200 geographic coordinates longitude and latitude (in decimal degrees). Each pair of coordinates coresponds to a geographic site. On the reference sheet, I have a set of 900 geographic coordinates longitude and latitude (in decimal degrees). Each pair of coordinates coresponds to a geographic site. Note that of the 900, 200 are the same from target sheet, other 700 are different sites. Using the spherical law of cosines, I can calculate the distance between a set of coordinates on target sheet agianst a set of coordinates on reference sheet. This allows me to see the distance from one geographic site, to the other. This was easy. The formula I use is as follows: ....
View Replies!
View Related
Determine Data Type Of Array Elements. Numeric Strings
I have an array of variants.. lvarArrSource = Array(12, "=F", 2, 3, 4, 5, 11, 6, 7, 8, 9, 10, "123", "F", "F", "F", "F", 11, "F", "NR", "F") which i am using to map columns between spreadsheets. The basic numeric entries refer to columns to copy. But I want to make the routine smarter with the strings. If array(x) = 12 (For example) Then Do something End If If left(array(x),1) = "=" Then Do something Else End If If array(x) Is String literal (e.g "xyz" Or "123") Then Do a third thing End If i cant find a typeof or isstring kind of function. Isnumeric works ok for some values but quoted numbers (eg "123") return true (which isnt what i want). I have tried the left(string,1) = """ but excel seems to hide the quotes.
View Replies!
View Related
Interpolate Two-dimensional Array
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 Replies!
View Related
Function For 2-dimensional Array
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 Replies!
View Related
Summing In A Multi Dimensional Array
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 Replies!
View Related
Multi-dimensional Array Solution
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 Replies!
View Related
Populating A Multi-dimensional Array
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 Replies!
View Related
Fill ComboBox With 2 Dimensional Array
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 Replies!
View Related
Evaluate Multi-Dimensional Array Matrix
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 Replies!
View Related
Multi-dimensional Array Not Showing In Listbox
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 Replies!
View Related
Fill Range From Multi-dimensional Array
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 Replies!
View Related
Join Dynamic Multi-dimensional Array
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 Replies!
View Related
Fill & Rearrange Multi-dimensional Array From Another
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 Replies!
View Related
The Array Type
where I can find some documentation or information (exluding the Excel helpfile) about Excel's Array Type? There seems to be an inexplicable lack of information about it! To be clear, when I say "array type", I mean the data type that the TYPE() worksheet function returns a value of 64 on.
View Replies!
View Related
UBound Array - Type Mismatch
This is the first portion of my code. When it reaches x1, it dies... I put in a break... when I highlight that line, it displays: UBound(myArray1, 1) = Public Function M_ADD(myArray1, myArray2) Dim i As Integer, j As Integer Dim x1 As Long, x2 As Long Dim y1 As Long, y2 As Long If VarType(myArray1) >= vbArray Then x1 = UBound(myArray1, 1) '
View Replies!
View Related
Lookup Values From A Multi Dimensional Table / Data Sheet
I have a sheet that has to look up value on a report from a sheet sheet that has more than value. Ex) On the report I have values 123A and 1234A On the data tab I have table that has. Ref Tot Value Desc Value1 Value2 Value3 1 123A Widgets 1 2 3 2 123A Widgets 4 5 6 Ref Tot Value Desc Value1 Value2 Value3 1 123B Nuts 7 8 9 5 123B Nuts 1 3 5 Ref Tot Value Desc Value1 Value2 Value3 7 1234A Bolts 2 4 6 11 1234A Bolts 3 5 8 So the report need find the values for Value 1, 2, 3 on where the value matches the data tab.
View Replies!
View Related
Looking Up Row Array Data In Column Array
On one sheet (KPI) I have either the values "x" or "" in the range A84:A89 to mark wheter to use the corresponding project in the range B84:B89. On the sheet X-ref I have the same project names in range T4:Y4 and a corresponding target value in T8:Y8 What I want is the sum (or average) of the marked-projects target-values. The result should end up in KPI!G31. In other words I want =sumif(A84:A89;"x";'X-ref'!T4:Y4) but it doesn't work since the first range is an column-array and the second range is an row-array.
View Replies!
View Related
Numbering For Coordinates
how to get a single cell (C2) and (D2) to make the numbering format go from (## ## ##) to (######). The Excel spread sheet is a coordinate converter, designed to take Degree's minuets seconds and convert it to Decimal Degrees, the formula is set up and work Great, but every time I copy and paste the coordinate to the excel spread sheet, i have to manuelly erase the spaces between the numbers so the formula can work properly. How can i get the cell to automatically delete the space between the numbers to save me time.(I.e 29 35 42.34325 -to-> 293542.34325)
View Replies!
View Related
Sorting 2 Different Type Of Data / By Colors
i have a file which consist of sheets called june 2007, color, and report. When i click on the command button on sheet june 2007 the code works and copies some data into sheet called report in that case some of them white color copied over and some of them blue. Since at the actual file there are nearly 500 rows and 32 columns when the report works, i want to sort each colors individually by looking the values at column called ETA (column "E") white rows should be sorted in ascending order in column e wise blue rows also should be sorted in ascending order in column e wise each colors should be sorted individually
View Replies!
View Related
Limit Entry According To Data Type
I have a user form with textboxes on it, in some text boxes, text should be entered, but in some number should be entered, and in some date is required, but How can control the entry, if some one type text instead of number, then it should not be accepted. NOTE: Before I have seen such example here, that uses the KeyPress event.
View Replies!
View Related
Chart Type For Data Comparison
I am trying to figure out a way in excel to graph some data I have in a new, sophisticated type of chart. My data is new square foot sales divided by new square feet (for a retail store). It is a dollar amount. I also have this data as a percentage change year over year. If I want to compare two stores with different data -- what would be the best way to present it on a chart. Is there a way to show this on a 3-D plane so that both companies have the data in the same chart up against each other?
View Replies!
View Related
Calculating Distance Between Coordinates
i use a Trimble Total Station Survey equipment, This is used for suveying and measuring distances between points on jobs. These points can be exported onto the pc as a text file and imported onto excel, the file has a northing and easting to locate the point these are comma separated. I would like to know if excell is capable of working out a distance betwen two of these such points by using the two pairs of northing and easting coordinates. The maximum distance between two points is no more than 50 meters. If for example when imported onto excel point 1's coordinates are locted in cells A1 and B1 and points 2's coordinates are locted in cells A2 and B2.
View Replies!
View Related
XYZ Coordinates Graph 3D
I have the following data: X Axis - Years (2004, 2005 ,...) Y Axis - Quantity (imported, exported, produaced) Z- Axiz - Name of the products I want to make a graph with teh X, y,z axis in excel. When i use the 3D graphs in excel, it is not taking the z vales connected to teh cell.
View Replies!
View Related
Calculate Angle From X, Y Coordinates
I have a userform, on it is a very large command button with a picture of a map loaded on the button. The button is 500 width(X) by 500 height (Y), so the center of the button would be at the location 250 (X) by 250 (Y). The button is coded for mousemove to get the X,Y cooridates and when you _Click the button a textbox gives the distance to the point(mousemove) from the center of the button. All that is good, but now I'd like to find the degree of the point referenced to a compass, ie, if the point is at 250 (X) and (Y) is less than 250 then the point would be due north at 0/360 degrees and if the point (Y) is greater than 250, it would be south of the center of the button. I hope this make sense. It's been a long time since trig. I've been searching but can't seem to find the correct formula to figure this out. Here's the other problem, I'm doing this in powerpoint so I'm not sure if cos or tan functions are loaded in this program. I am posting this in the xl forum because I figure that's where most of the people who could figure this out are. If this is in the incorrect forum I can try to move it,
View Replies!
View Related
Data Type Of Items In Controls Collection?
I have a UserForm function which accepts as a string the name of a TextBox control on the form. The function returns a reference to the named TextBox control (or Nothing if the control does not exist). I have the function header defined this way: Public Function TextBox(byval strName as String) as TextBox The function returns a reference to the TextBox control like this: set TextBox = Me.Controls.Item(strName) (I know, the .Item is not required.) The code which calls the above function first declares a TextBox object with this Dim statement: Dim txtTextBox as TextBox The routine then goes on to call the TextBox function like this: set txtTextBox = TextBox(strTextBoxName) When run, the above statement genrates a Type Mismatch error. I'm confused, because if I 'TypeName()' the TextBox function's returned value, it's "TextBox,". I thought I could work around this problem by changing the TextBox function's return value's data type to Variant, but that produced the same result. The only "solution" I've come up with is changing the TextBox function's return value's type (and any reference to the functions' return value) to Control. I expected that the Controls object would behave similar to a Collection object in that it's items can be different types (TextBox, Label, CommandButton, ListBox, etc.) and no Type Mistmatch erros occur so long as the type of the item returned matches the type of the variable referencing that item. But is seems that Controls requires that any reference to one of its items must be type Control, not the actual type of the item returned. I'd prefer not to use Control data rypes in my applcation, as that would require additional code in all of my subs and functions to ensure that any Control object passed to it is the correct type of control (TextBox, Label, etc.). Can anyone explain what's going on here? Why shouldn't I be able to assign a TextBox type variable to Controls.Item("xyz"), so long as the item returned by Controls.Item("xyz") is type TextBox?
View Replies!
View Related
Extract Data By Type To Separate Workbooks
I have created a workbook for a co-worker. The way it works is data comes from an outside source with customer names in Column A and their Account Reps in Column H. This data is pasted into a template that I created with a very simple macro recording that filters on each Account Rep and is copied and pasted each into a different workbook. Then I had to go through each workbook (because of the info being sensitive) and create a macro that deletes the unwanted data because when the data is pasted it transfers all of the data and you can unfilter to see the full sheet. I know there is a better way to extract data on each change in column H into a new workbook. Does anyone know how to do that? Another issue is the original data is not very clean so there are blank rows in the list. For Example: CustomerTechnology SegmentOpportunity Dollars ($)Opportunity StatusAction Item(s)(ST) or (LT)Due dateAcct RepCustomer 1Action 1ST3/30/2008ACCustomer 2Technology 1Action 2LTTBDACCustomer 3Technology 2$10,000FindAction 3LTTBDACCustomer 4Technology 3FindAction 4LTTBDBHCustomer 5Technology 4FindAction 5LT1/31/2008BHCustomer 6$30,000Action 6LTTBDBHCustomer 7Action 7LTTBDMJCustomer 8Technology 5$10,000QualifiedAction 8ST3/1/2008MJCustomer 9Technology 6QualifiedAction 9ST2/28/2008CGCGCustomer 10Technology 7$18,000FindAction 10ST3/1/2008CGCustomer 11Technology 8$10,000QualifiedAction 11ST3/30/2008BHCustomer 12Technology 9FindAction 12LTTBDACCustomer 13FindAction 13LT3/15/2008AC
View Replies!
View Related
Method Failed Error And Data Type
The error is: Method 'Range' of object '_Global' failed Line it fails on: Set r = Range("myRange") Sub LearnCells() Dim r As Range Dim n As Long Set r = Range("myRange") For n = 1 To r.Rows.Count If r.Cells(n, 1) = r.Cells(n + 1, 1) Then MsgBox "Duplicate data in " & r.Cells(n + 1, 1).Address End If Next n End Sub Questions: 1) 1st Dim statement, is this valid? I still get a little unsure- in the data type lists in the help file, the list file does not list things like Workbook, Worksheet Range. 2) Why is the error ocurring?
View Replies!
View Related
Convert Lat/longs Coordinates
I'm trying to create a spreadsheet that will convert coordinates from DDMMSS.00 to DDMM.000. I found another thread that discusses this same issue, but I was unable to make it work for me. I'm attaching a sample spreadsheet that basically shows what I'm trying to do.
View Replies!
View Related
Calculate Shortest Distance From Coordinates
I want to use a User Defined name look up its corresponding X/Y Coordinates , reference a list organized by categories, then go through each name in the list finding each's X/Y Coord Calculate distance. SQRT((X-X)*(X-X)+(Y-Y)*(Y-Y)) where X and Y are Coordinates & Return the name of the smallest Value.
View Replies!
View Related
Finding The Hypotenuse Of From Two Pairs Of X,Y Coordinates
I have a map with several waypoints and would like to find the distance between any of these two waypoints. Sounds simple, but I have having an issue with the later parts of the excel file. Let me explain further. There are over 100 waypoints on this map we have. Each waypoint has an, seemingly arbitrary, X-coordinate and Y-Coordinate. However, if you divide the coordinates by [X], they turn into miles. It should go without saying that finding the distance between two waypoints is rather simple mathematically, but I having an issue figuring out how to pull two random waypoints and having the distance automatically calculated. So far, I just have column A with the waypoint name and with column B and C having the X and Y coordinates respectively. Is there anyway I can create some sort of call function that when two waypoint values are entered it would automatically calculate the distances?
View Replies!
View Related
Extract AutoCAD XYZ Coordinates
I am trying to extract (and separate into 3 columns) the numbers only, positive or negative portion of (XYZ) Coordinates copied from AutoCAD and pasted into column A X = 96179.9699 Y = 61973.9793 Z = 1368.0025 In column B,C and D, I have tried to use Find Mid and other means
View Replies!
View Related
Count Geographic Coordinates Within A Range
I have 2 columns of longitude and latitude coordinates. I want to count coordinates within certain ranges. A bit like using the Frequency function but for 2 sets of values and 2 bins arrays. This would mean I could create a table with latitute bins as the row headers and longitude bins as the column headings. Would anyone know how to do this?
View Replies!
View Related
Calculate Relative Vector Coordinates
I am running a fairly complex simulation at work and have quite a few different functions in it. For the simulation to work properly, i need to have the Solver add-in and the Analysis ToolPak installed. Everytime that i try and use the simulation on a different computer (or if anyone else tries to run it) the add-ins must be enabled again. Is there a way to set up a macro to enable them when either i open the simulation (first preference) or when a button is pressed (2nd preference).
View Replies!
View Related
Pass Element Of User-Defined Data Type
I have an array with structure, i.e. User Defined Type. Assume the user defined type has two elements: Element1 and Element2 and array name is Array. So the definition is: Dim Array(1 To 10) As UserType and access to elements is Array(5).Element1 The problem is that I need to pass the whole set of Element1 or Element2 to a function. Should it have been two separate arrays, it would not be a problem. But because of the user defined structure I have no idea how to pass a single element. I hope there is another solution rather than to use loops. I have many arrays like this with complex structures. I simply can not replicate all of them.
View Replies!
View Related
Determining Data Type Of Argument In Custom Function
In VBA, True takes the integer value of -1. However, in Excel, it is 1. I am writing a custom function that does arithmetic on a value. However, due to above, if the value is True, my custom function produces a different result than if I wrote an Excel formula to do the same thing. Is there some way to identify the data type of a value passed into a function? Currently my function looks like this: ' Return the valueToIncrement with its magnitude increased by PctToAdd Public Function INCREMENTPCT(valueToIncrement As Variant, PctToAdd As Variant) As Variant INCREMENTPCT = valueToIncrement * (1 + PctToAdd) End Function Ideally I would like to identify whether the type is Boolean and adjust the value so as to give the same result as an Excel formula would give.
View Replies!
View Related
Wrong Data Type Supplied To UDF Error
My colleague and I are writing a udf which uses a "match/ index" combination to return a value to a cell from a named range in another sheet. The cell returns returns the error "value used in the formula is of the wrong data type". When we break down the code into a function which refers directly to the relevant cells, and a sub which returns the value in a message box, it works correctly: here's the code for the function and test sub: Function MRL(PropertyType, ReturnType, Location, Year2) ....
View Replies!
View Related
Modify Free-form Shape Coordinates
Right now I'm modifying a figure based on size data in an excel table. I'm modifying the X/Y coordinates of the points of the freeform shape with VBA, however, I have to use absolute x,y coordinates. I'd like to be able to move the shapes throughout the sheet. With fixed coordinates, this makes it difficult. I'm hoping there's an easy way to it
View Replies!
View Related
ActiveCell.Address - Discarding Fixed Coordinates
I'm attempting to write a piece of code that builds a formula dependent on the location of the cell it is being created in. The relevant line of code currently reads as follows: ActiveCell.Offset(0, 5).Value = "=" & ActiveCell.Offset(0, -5).Address & " & " & ActiveCell.Offset(0, -6).Address Which when activated in cell A3, will enter the formula =$A$3 & $A$2 However, I would like to know if there is a way of automatically building a formula like this, only without the absolute references. Reason being, this formula is used in a large table, which is sorted in date order automatically when the sheet is activated. Since the code generated will point at the row it was generated on, when the table is sorted, this formula will calculate the incorrect result.
View Replies!
View Related
Getting Max Value Of A Point Inside A Square Defined With X,y Coordinates
I have a square which is defined with x,y coordinates (roughly 2000 points), and for each point I have a value. And I have to divide this square in to 9 equal sub grids, and find the max value in each sub grid. I have all the coordinates for the sub grids. But I can’t get the max value of the specified cells. I am thinking something like this: if 0<x>10 and 0<y<10 then it is sub grid 1 and I want to find the max value there and if 0<x>10 and 10<y<20 then it is sub grid 2 and so one…..
View Replies!
View Related
|