I have an array of letters which are arranged in some abitrary shapes - for example, say:
I want to create a second array such that each cell in the array is equal to the number of cells in the region of the corresponding cell, or in other words, the area of each region - that is, each cell needs to count how many cells in its neighbourhood share its value. For this example above, that'd be, uh...
(Where I've used a and b here to mean the hexadecimal 10 and 11 for the purposes of keeping this properly table aligned - the real one can use whatever size number it likes.) Since there are non-contiguous areas using the same letters, then naturally a plain ol' COUNTIF won't do the trick. I'd like to do this in pure Excel, no VBA. I feel like this an algorithm that ought to exist, but all of my ideas so far either leave cells out or keep double-counting cells.
Code:
OXOXOOXO
OXOXOOXO
OXXXOOXO
OXOXOOXO
OXOXOOXO
I want to create a second array such that each cell in the array is equal to the number of cells in the region of the corresponding cell, or in other words, the area of each region - that is, each cell needs to count how many cells in its neighbourhood share its value. For this example above, that'd be, uh...
Code:
5b2baa55
5b2baa55
5bbbaa55
5b2baa55
5b2baa55
(Where I've used a and b here to mean the hexadecimal 10 and 11 for the purposes of keeping this properly table aligned - the real one can use whatever size number it likes.) Since there are non-contiguous areas using the same letters, then naturally a plain ol' COUNTIF won't do the trick. I'd like to do this in pure Excel, no VBA. I feel like this an algorithm that ought to exist, but all of my ideas so far either leave cells out or keep double-counting cells.