I've hit a wall and am not certain how to proceed. Any help is appreciated!
The attached image is a representation of my worksheet which is much larger.
Problem: Column I & J & K is to be populated with an equation that iteratively calculates the median of its neighboring cells. Column I uses H, while J uses I and K uses J.
Column G and H are paired datasets that represent information pulled from a table, G being the cell reference and H being its value.
The goal of the equation is to have it take the cell reference in column G and then find the neighboring cells of its INDIRECT reference, ex: D4 would calculate the median of C3,C4,C5,D3,D5 (and E3,E4,E5 assuming they weren't off the table).
This is what I've come up with:
=MEDIAN(INDEX(H$2:H$13,TARGET CELL,TARGET CELL2,TARGET CELL3,TARGET CELL4,TARGET CELL5,TARGET CELL6,TARGET CELL7,TARGET CELL8)
Each TARGET CELL has a variation of the following, where the offset is modified to target a different direction:
MATCH(ADDRESS(ROW(OFFSET(INDIRECT($G2),0,-1)),COLUMN(OFFSET(INDIRECT($G2),-1,0))),$G$2:$G$13,0))
It gives me an #N/A error when MATCH attempts to return a value that has no match in column G (It's value is at the edge of the table).
Is there a way to have my equation calculate the median while discarding the match results that return #N/A?
I was hoping to have this all calculated in single cells, but if it isn't possible I am aware that I can calculate each neighboring cell in its own helper column then discard the errors.
Is there a better approach or a solution that doesn't involve 8 helper columns? Thanks in advance for taking the time to read my question.
The attached image is a representation of my worksheet which is much larger.
Problem: Column I & J & K is to be populated with an equation that iteratively calculates the median of its neighboring cells. Column I uses H, while J uses I and K uses J.
Column G and H are paired datasets that represent information pulled from a table, G being the cell reference and H being its value.
The goal of the equation is to have it take the cell reference in column G and then find the neighboring cells of its INDIRECT reference, ex: D4 would calculate the median of C3,C4,C5,D3,D5 (and E3,E4,E5 assuming they weren't off the table).
This is what I've come up with:
=MEDIAN(INDEX(H$2:H$13,TARGET CELL,TARGET CELL2,TARGET CELL3,TARGET CELL4,TARGET CELL5,TARGET CELL6,TARGET CELL7,TARGET CELL8)
Each TARGET CELL has a variation of the following, where the offset is modified to target a different direction:
MATCH(ADDRESS(ROW(OFFSET(INDIRECT($G2),0,-1)),COLUMN(OFFSET(INDIRECT($G2),-1,0))),$G$2:$G$13,0))
It gives me an #N/A error when MATCH attempts to return a value that has no match in column G (It's value is at the edge of the table).
Is there a way to have my equation calculate the median while discarding the match results that return #N/A?
I was hoping to have this all calculated in single cells, but if it isn't possible I am aware that I can calculate each neighboring cell in its own helper column then discard the errors.
Is there a better approach or a solution that doesn't involve 8 helper columns? Thanks in advance for taking the time to read my question.