dropkickweasel
Board Regular
- Joined
- Feb 2, 2014
- Messages
- 70
Say I have a 21x21 range in cells A1:U21.
The content of the cells will change regularly, but at certain intervals I want to know some information about the contents.
Values in the cells will only ever be a single letter, or empty.
Is there any way to calculate the longest path of orthogonally adjacent cells with the same value?
Or even better, the longest path of orthogonally adjacent cells with one of three values?
There may be several different (and branching) paths of the same value, but I only care to know the length of the longest one.
Here is a visual example:
In this image, I would want to know the length of the longest path made of the letters R, B and D which I have manually identified with red text across the middle.
I would also want to know the length of the longest path made of the letters W, B and D which I have manually identified highlighted in yellow.
It may be possible, as in this case, that there are two identically long paths. As I don't care for the location of the path, either is a valid result as the length is identical for both.
Does anyone have any ideas how I might go about automating identifying longest contiguous paths within a range?
The content of the cells will change regularly, but at certain intervals I want to know some information about the contents.
Values in the cells will only ever be a single letter, or empty.
Is there any way to calculate the longest path of orthogonally adjacent cells with the same value?
Or even better, the longest path of orthogonally adjacent cells with one of three values?
There may be several different (and branching) paths of the same value, but I only care to know the length of the longest one.
Here is a visual example:
In this image, I would want to know the length of the longest path made of the letters R, B and D which I have manually identified with red text across the middle.
I would also want to know the length of the longest path made of the letters W, B and D which I have manually identified highlighted in yellow.
It may be possible, as in this case, that there are two identically long paths. As I don't care for the location of the path, either is a valid result as the length is identical for both.
Does anyone have any ideas how I might go about automating identifying longest contiguous paths within a range?