Tracker
HOME    TRACKER    Excel

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

Related Forum Messages:
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)

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.

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.

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.

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

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,

Fill-in As Pairs
I'm looking for an easy way to fill-in 1600 cells, in Col. "A", with pairs of sequential numbers [from 1 to 800] - for example:

1
1
2
2
3
3
4
4
5
5
6
6

I managed to achieve something close with: =INT(ROW()/2.05)+1 but this is not accurate enough.

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.

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?

Add Shape & Textbox Values For Coordinates
i am trying to enter the EndX coordinates (The third number: 500) by entering a number in a forms textbox

ActiveSheet.Shapes.AddLine(0, 100, 500, 100).Select

how can i break the code up to enter the coordinates via textbox's

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

Show 3digits Under Pairs
Need formula? We have a pair of numbers in D1,E1,and F1…..
We want only the numbers that have 12 from column A and B

66 from column A and B

18 from column A and B only

A B C D E F
1

12 66 18

456 123
129 667 481

667 234
123 366 881 .........

Extract Even/odd Pairs From A Number
I would like to know if its possible to extract just the even/odd pairs from a number.

Exp. I have the number 123 in cell A1, and would like to extract the even/odd pair, which in this case would be 13, the cell A2. I would like to be able to do this without the use of "Isodd" or "iseven" functions.

Matching Pairs Of Data
I'm not sure if it's possible to do this, but I have three lists of data. One is a complete list (for example, the numbers 1-25).
The next list is a subset of the complete list (e.g., 1,3,5,7,9). Attached to these (the subset list) is another list (let's say letters, so A goes with 1, B goes with 3, etc). I want to physically move the paired entries from Lists 2 & 3 so that List 2 matches up with List

1. Let's see if I can represent this visually:

I have:

1|1|A
2|3|B
3|5|C
4|7|D
5|9|E
6|
7|
8|
...
25|

I want:

1|1|A
2|
3|3|B
4|
5|5|C
6|
7|7|D
8|
...
25|

Count Pairs In Range
I am trying to analyse a set of variables in my dataset.

The variables I have are numbers which are organised into a single column.

I want to count the number of times different variable pairings occur within my data.

An example dataset of mine is: 1,2,4,2,1,3,5,3,2,1

As the dataset contains 5 variables (1,2,3,4,5) the potential combinations are: 1,1; 1,2; 1,3; 2,1; etc.. with 25 in total.

I want Excel to move through this column starting with the first two cells and step down 1 cell each time and then tell me the number of times each of the combination occurs.

Check For Pairs Occurrences
I am looking for a code which will check and display the Maximum Occurrences of pairs of 2 Characters.

In the attached file I tried to write some code but it seems to be wrong.

For your convinience, I entered the reuslts in a table (hopefully not mistaken).
The code should display a MsgBox saying that "The pair 'ab' was found 6 times in A1.

The string, in A1, can be any string in any length.

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

Macro To Solve For Cartesian Coordinates On An Ellipse
Does anyone have a macro they have created or know of that can solve the X and Y coordinates on an ellipse? Would you be willing to share here or send it to me in a personal email?

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.

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

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.

Can Work Out Unique Pairs Of Numbers
I need to pair up 20 people in sequence for a workshop, so I number the people and can rotate people numbered 1-10 with 11-20 easy enough, but when it gets to pairing 1-10 together in pairs and 11-20 in pairs.

Is there a formula I could use in Excel to work out the easiest pairing for me?

Combination Of Pairs, Power And String
I have a string of n pairs and want to check various combination of that string.
Example: Pairs 58 78 15
Since I know I have 3 pairs (but it can be 2 or 4), I know the number of combination I want to test, ie 2 power 3 = 8 combinations. How can I program a code creating the various strings, ie 587815, 587851, 588715, 588751, 857815, 857851, 858715, 858751 ?

This is what I have so far (not much):

Public unique_pair 'number of pairs provided by another macro
Public mystring 'provided by another macro
Sub make_guess()

Dim number_of_combination, i
number_of_combination = 0

number_of_combination = 2 ^ unique_pair
For k = 1 To number_of_combination

'how to generate the various string ????

Next k
End Sub

Formula Grouping Number Pairs
How do I express the following as a formula for range f2:h2:

case 1
if any number is equal to 0 or 5, then 1
if any number is equal to 1 or 6, then 2
if any number is equal to 2 or 7, then 3
if any number is equal to 3 or 8, then 4
if any number is equal to 4 or 9, then 5

example:
f2:h2=3,5,9
result
415

f2:h2=0,2,7
result
133

Matching And Sorting Non-Identical Row Pairs
I have a database with 6 columns in play (there are actually other columns but they are not relevant). I'll call the columns A through F. I would like to be able to match certain counterpart rows together, do a sort placing the counterpart rows adjacent to one another, and then count how many pairs I have. (Some rows will have no counterparts.)

Here is a micro-illustration of the database:

______A______B______C______D________E_____F
R1___01-03___54____959____nsneakr___24____yes
R3___01-10___42____344____calb3wd___11____no
R5___01-25___54____959____nsneakr___24____yes
R6___02-02___54____959____nsneakr___24____no
R7___02-14___54____959____nsneakr___24____no

I basically need to devise a formula or script that pairs together two rows that fit the following criteria:

1) The rows are identical in Columns B, C, D, and E.
2) The rows are not identical in Column F (i.e., one half of the pair should have "yes" and the other half should have "no")
3) The rows are as close together as possible according to the date sequence in Column A. For example, Row 1 should pair with Row 6, and Row 5 should pair with Row 7. Row 1 should not pair with Row 7, and Row 5 should not pair with Row 6. **This criterion seems tricky because R5 and R6 would technically fit the requirement for pairing, were it not for the fact that R1 comes earlier in the sequence.**

Counting Pairs From 4 Digit Lottery
I am tring to list and count how many pairs in a 4 digit lottery?

no duplicates ...

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

Button Position/Coordinates On Worksheet. Discrepancy Between Versions
Add Multiple Buttons That Select Row Of Housing Cell. One of my Macro's places a button on a sheet using Top/Left;

Set sbut = Sheets("Listings").Shapes.AddFormControl(xlButtonControl, _
Range("J" & count).Left, Range("J" & count).Top, 50, 12)

When I try to find the row of the clicked button using the following code;

The code behaves differently in Excel 2002 and 2007. In 2002 it returns the row the button sits on, but 2007 returns the cell above the button. This could be because the workbook is an XLS running in Excel 2007 in compatibility mode? Is there a way to "nudge" the button down a little after it has been placed using .top/.left ? Or is the only way around this something like;

count = ActiveCell.Row
If Application.Version >= 12 Then
count = count + 1
End If

Is this a bug, or something that I am doing wrong ? The workbook needs to be a .xls to ensure that it works in older versions of Excel.

Copying Cells To The Neighbouring Column In Pairs Along Row 1
So I have a spreadsheet that has a Title in Cell A1, then entries in B1, D1, F1, H1, J1, etc... with empty cells between.

What I would like to do is copy those entries to the right, i.e. B1 into C1, D1 into E1, F1 into H1, but all the way along because in my master sheet there are a lot of columns.

Match Up & Clearly Highlight The Pairs (duplicates) In Each Coloumn
john@yahoo.com
Sam@hotmail.com
etc
etc
>6000 more email address9000 more email addresses)

I need to match up & clearly highlight the pairs (duplicates) in each coloumn.
What's the trick for this?

Make A Mcaro Loop Through 5 Pairs Of Columns
I've managed to get my macro to work ok - but what I want to do now is to get it to loop through more columns. Currently it looks for email addresses in column AH (which will always be the same) then it looks for a "yes" in columnAB and if there is no "SENT" in column T then it sends an email,after which it adds the word "SENT" to column T. What I want t do is for the macro to then run on columns AC+U, AD+V, AE+W and AF+X. So basically it will loop through one column to the right each time for a total of 5 pairs of columns

Find Pairs Of Records And Strip Out Remainder
I have one hundred rows of data and within that there are some records which are the same and they will always be in pairs - identifiable by a cell with the same ref common to both records. how to strip out the records that are not part of a pair? I would like remove all of the non pairs and move them to another sheet.

Estimate Linear Formula From Multiple Coordinate Pairs
I have 32 pairs of coordinates (X,Y). If I graph them using a scatter chart in Excel, I can see that it looks like they suggest a linear relationship between the points.

Other than printing the chart and trying to draw a "best fit" line manually, is there some sort of way I can get Excel to come up with the "best" linear formula (y=mx+b format)?

How To Use One Cell To Match Pairs Of Cells For Missing Items
We use a program at work to check items out to individual people but sometimes an item is missed and it takes forever to manually look for who it is. In the attached example, (keep in mind there might be more than 100 people on this list...this is just two people), the first 2 items are a pair (radio and radio case) and the second 2 items are a pair (laptop and laptop case).

Id like a way (condition formatting) to flag a person who has one item from the pair checked out and not the other. (Ive manually highlighted one person who only has one of the paired items...id like this to happen automatically)

EDIT:: If the first person were missing the radio in this example, his name would be highlighted on the line with the matching pair...cell D1 (radio case)

Other information:

Radios will always be RFAMRC***
Radio cases will always be RFAMF****

Laptops will always be RFAMTD***
Laptop cases will always be RFAMTE***

Nested AutoshapesL: Display Several Pairs Of Boxes, Which Consist Of A Descriptor Box And A Value Box
I have a problem when using autoshapes. Above a display of columns of data, which are of different widths, I need to display several pairs of boxes, which consist of a descriptor box and a value box. If I use formatting in cells, I am constrained to use the width of the columns below. So I will be using autoshape rectangles. No limit on box widths and I can link each one to a cell to send text to them. So far so good.

However, I would like to contain a group of these box pairs within another autoshape. When I do this, if I fill the outer autoshape with colour, I have the choice of making the colour solid, which means you can't see the inside box pairs at all, or semitransparent, which allows the boxes to loom through a fog of the outer colour. What I would like is for the inner boxes to show properly, and fill only the space between the inner boxes and the rim of the outer autoshape

Count How Many Times A Given Date Falls Between Date Pairs
I'm trying to use countif or similar to show how many times a given date is between 2 dates (inclusive). Each row of the spreadsheet contains amongst other info, a Start Date and an End Date. If i've got 2 rows like this:

StartDate EndDate
01/01/2009 03/01/2009
02/01/2009 04/01/2009

I'd want to lookup 02/01/2009 and have it return 2 (02/01/09 falls between the dates on row 1 and the dates on row 2). To give some context, this is an export from a database containing staff holiday dates, and I'd like to be able to see how many people will be on holiday on any given date, given the start and end date of all holiday occurances throughout the year.

Copy Pairs From 2 Columns To Formula Reference Cells & Copy Updated Formula Results
I am currently working on a data analysis project (data mining) and need to collect and later analyze statistics for the inputs which control a series of calculations. These statistics are shown in the Statistics 1, Statistics 2 and Statistics 3 cells in the workbook that I attached. The inputs are X,Y; all possible values for these inputs are listed in the N,O columns. Basically I need a macro which would take the values from these two columns and place them pair after pair into the controlling cells (K3, L3), then it would copy cells H2 through L3 (updated stats) to a new sheet after each copy operation - so that I will finally have a list of statistics for all of the input pairs.

Finding N/A
I have sheet with rows and column from cell(1,1) to Cell(8,18) and it has #N/A inside these data. Is there a way to use Find function to find #N/A and replace it with empty space?

Finding Last Row
I am working on a macro that has a VLookup in it.

The sheet that this will be applied to comes in weekly and can have anywhere from 10K to 30K.

I want the VLookup equation to be able to find the last possible row with data in column A and then copy the Vlookp equation in column B to the last row.

Can someone please provide the correct code that will allow me to do this?

Finding The Value
In my code I have a very useful line:

[other code stuff here]...Range("J" & Rows.Count).End(xlUp))

That helps me find the value in the last row that actually has data in my spreadsheet. This is great, but I want to try to accomplish the same thing without vba. In other words, in cell A3, I always want the value that is in the J column, but the last row that has data. (In other words sometimes the last data row ia 97, sometimes it is 23.) Since the value is always changing this won't be vlookup. Is there another excel function that can find the end without the use of vba?

This might seem goofy to need to do since I already know how I can in vba, but in my (admittedly pathetic code) I keep have an endless loop and if I can figure out a way to get this value on the ss.

Finding 3 MAX Using VBA
I need to find, using VBA, three highest numbers out of entire column (L), select 13 appropriate ranges like for L9 - A9:M9 , for L8 - A8:M8 and for L7 - A7:M7 and copy to a different sheet.

Finding Subtotal Row When It Changes
I tried "googling" this, but I can't seem to find an answer. Is there a way in VBA to refer to the "subtotal" row(s) in a sheet? I have a large sheet that has a varied number of rows. Each month the data changes and I have to go in to the report, subtotal by one column and then enter a specific formula into the subtotal row.

Is there a way to reference the subtotal row in VBA so I can write a macro that will do this all for me? There are typically a varied number of subtotal rows and the locations of them change depending on the amount of data we have each month.

Finding Where A Range Name Is Used
I name a range "MyList".

In another cell, I use Data.Validation.List and use "MyList" as the source.

Now I find another range named "HisList". Is there some way to determine if "HisList" is being used as a source for some other validation somewhere in the workbook?

"Trace Dependents" doesn't work.

Finding The MAX Of A VLOOKUP
i have a couple of columns (J2:K393) and a cell (O2) elsewhere.
i need to look for the max and min values of that cell within my 2 columns.

this formula (i thought it would work) doesn't return the correct number.
what am i doing wrong?

=MAX(VLOOKUP(O2,\$J\$2:\$K\$393,2,FALSE))
=MIN(VLOOKUP(O2,\$J\$2:\$K\$393,2,FALSE))

Finding The Top 3 Of Each Area
I have a list of tons of items that have lost orders against them. The items themselves are catagorized in 11 different areas and I'm trying to find the top 3 of each Area. These items are sorted descending by the number of lost orders and will constantly be changing every day. Here is an example of how my workbook is set-up:

A B C D E ....

Finding Last Column
Using and array to go through a series of sheets and do stuff (Thanks Gerald and Von Pookie BTW). I have used code which finds the last row (varies from sheet to sheet), but not the last column (which also varies sheet to sheet).

Finding Last row
LastRow = Range("A" & Rows.Count).End(xlUp).Row

However this code doesn't seem to work for last column...sample...
LastCol = Range("A" & Columns.Count).End(xlLeft).Column

Is there a trick I'm not seeing? Does this only work using the 'Cell' function in VBA? If so, how would the line of code look? I'd really prefer finding the column letter as opposed to using the 'Cell' method if possible.

Finding Anything On The Loop
I'm having issues with finding anything on the loop that I'm going to need to run.

I need to open each xls file in a directory with a date in 2007. Inside of each file I need to copy a cell and paste that number into a new workbook in cell A1
Then close the first file, open the second, copy the cell and paste the data into A2. I would need this loop to continue until all files have been opened and had the data copied.

Look-up Macro Not Finding What It Should
I have the following macro that is supposed to find postcodes but it's not working correctly. I don't get an error message it just doesn't find any postcodes.

The postcodes are located on a sheet called "Postcodes" in A2-A2736.

If it finds the postcode it is supposed to return the contents of column B, E and F in a message box saying "B is your nearest branch. This is F miles away which should take E minutes to drive." B is the name of the branch, E is the drive time from the original postcode and F is the drive distance.

code[]
Sub FindBranch()

Dim MyPC As String, cl As Range, found As Boolean

found = False

how to display my code correctly.

LOOKUP Finding The Zero
I have a LOOKUP formula with MID in it to asign a Letter digit to each numeric in a certain position of a number. Works great (thanks jonmo1) on 9 out of 10 numerics.
see below

=LOOKUP(MID(AF134,4,1)*1,{1,2,3,4,5,6,7,8,9,0},{"V","T","A","P","L","K","H","J","E","C"})

But when that 4th digit is a zero I get #### instead of my C letter that I need.

Finding The Last Row In Data With VB
How would i write VB code that looks for the last row in my data table? I'm a total novice with VB but learning slowly..