Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calculating the distance between cells in excel (randomize moving cells)

Status
Not open for further replies.

RosaseLLEN

Programmer
Oct 20, 2022
1
0
0
PH
Suppose I want to compute the distance between a 3by4 cells in a square grid in excel. The distance between two cells is 1m.
Each grid cell is a number between 1 and 12 but randomized so every number can be anywhere.

For instance: (example in the bottom-left side of the grid):

1___2___3___4

5___6___7___8

9__10__11__12


distance between cells 1 and 5 is 1
distance between cells 1 and 6 is 2
distance between cells 1 and 12 is 5

the grid can also be this and other randomized forms:
1___7___9___12

8___2___6___11

10__8___3___4

Is it possible to have the formula to be able to calculate all of the distance between 2 cells????


Thanks for any help in advance! :)
 
Actually, I might take that back.

If we're allowed to cheat.
 
With a set of MATCH formulas it is possible to find row and column of a given number in table, next x and y distances can be calculated using ABS.

combo
 
How are you wanting to identify the cells you are measuring between? If you know the cells (e.g B1 and D3) it is easy. If you want to identify the, from the numbers they contain (i.e find the distance between 12 and 7, no matter where they are in the array, then that's more difficult to do in a single formula)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top