Range and Bearing

GSP!

New Member
Joined
Nov 14, 2007
Messages
14
Hi,

I'm building a VBA project but seem to have had complete brain freeze.

I have large data sets that are being manipulated.
Part of the project (and I thought it was a minor one) is to take National Grid coordinates (Easting and Northing) and create new data sets. The positioning device is offset from the other data collected by a fixed amount along and left or right of the line walked. Therefore, my intention is to allow the user to input an x (left/right) and y (along the line walked) offsets, take the bearing between to adjacent points (eg. pt1 and pt2), use that bearing from the preceding point (pt1) and create a new coordinate (r1) with the x and y offset. Then continue from pt2 to pt3 to create coordinates for r2.....etc.

.........r1...................r2...................r3....
pt1..................pt2.................pt3...............etc

In the real world pt1 to pt2 to pt3 are not in a perfectly straight line and can go in any direction. This is data collected at 10Hz walking along lines.

Before I committed to VBA I was trying to achieve this in Excel. I don't know whats happened to me - quadrants - they seem to be flummoxing me. Bearings are taken clockwise from zero at north. But as you move into each quadrant my calculations fall to pieces.

I think I've resharpened my pencil until it's almost gone!

If someone could give me a pointer it would be much appreciated - and save me a fortune in pencils!
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
At last - grey matter has returned!
I have found my own solution
=IF((D3/PI()*180)<0,360+(D3/PI()*180),(D3/PI()*180))
=IF(DEGREES(D3)<0,DEGREES(D3)+360,DEGREES(D3)) (alternative)
Where D3 (on this row) contained the calculated bearing between pt1 and pt2 added to the offset correction bearing in radians
Very easy, very stupid - basic maths
However, I can now move on with the thrust of the project
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,262
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top