Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am working on a program that uses the distance formula.
Example: =SQRT((B8-B7)^2+(C8-C7)^2) I need to find a way to substitute variables for the cell locations. B C X and Y 7. 64.4 25.5 8. 65.4 24.9 9. 73.6 23.5 10. 39.5 96 11. 19.5 33.6 12. 25.5 98 Reference X and Y 12.2 13.6 The Loop im trying to create will take the Reference X and Y and plu it into the distance equation along with the first X and Y in the char which is B7 and C7. That result will be outputed. The program with the take the next X and Y in the chart and calculate it with the sam reference. this loop with continue until it reaches the end of th chart. If anyone has any suggestions on how to do this please let me know. Thanks Nic -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
why not put the following formula in D7: =SQRT((B8-B7)^2+(C8-C7)^2) -----Original Message----- I am working on a program that uses the distance formula. Example: =SQRT(($E$1-B7)^2+($F$1-C7)^2) and copy down. Where E1 and F1 store your reference values I need to find a way to substitute variables for the cell locations. B C X and Y 7. 64.4 25.5 8. 65.4 24.9 9. 73.6 23.5 10. 39.5 96 11. 19.5 33.6 12. 25.5 98 Reference X and Y 12.2 13.6 The Loop im trying to create will take the Reference X and Y and plug it into the distance equation along with the first X and Y in the chart which is B7 and C7. That result will be outputed. The program with then take the next X and Y in the chart and calculate it with the same reference. this loop with continue until it reaches the end of the chart. If anyone has any suggestions on how to do this please let me know. Thanks Nick --- Message posted from http://www.ExcelForum.com/ . |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nick,
The following is a possible VBA solution which may get you going. Sub Table() Dim Rw, Res Dim x1, y1, x2, y2 x1 = 12.2 y1 = 13.6 Rw = 7 Do x2 = Cells(Rw, 2): y2 = Cells(Rw, 3) Res = Sqr((x2 - x1) ^ 2 + (y2 - y1) ^ 2) Cells(Rw, 4) = Res x1 = x2 y1 = y2 Rw = Rw + 1 Loop Until Rw 12 End Sub x1 znd y1 are set initially to the reference values. The results of the calc. show in column 4 Hope that helps a bit. Regards, Don "woknick " wrote in message ... I am working on a program that uses the distance formula. Example: =SQRT((B8-B7)^2+(C8-C7)^2) I need to find a way to substitute variables for the cell locations. B C X and Y 7. 64.4 25.5 8. 65.4 24.9 9. 73.6 23.5 10. 39.5 96 11. 19.5 33.6 12. 25.5 98 Reference X and Y 12.2 13.6 The Loop im trying to create will take the Reference X and Y and plug it into the distance equation along with the first X and Y in the chart which is B7 and C7. That result will be outputed. The program with then take the next X and Y in the chart and calculate it with the same reference. this loop with continue until it reaches the end of the chart. If anyone has any suggestions on how to do this please let me know. Thanks Nick --- Message posted from http://www.ExcelForum.com/ |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Selecting All Rows with Certain Data | Excel Discussion (Misc queries) | |||
after selecting 50 rows of a column i can't reference the cells in the rows | New Users to Excel | |||
Selecting Rows | Excel Worksheet Functions | |||
Selecting Rows | Excel Programming | |||
selecting rows | Excel Programming |