Identify a child cell in an array

2019-04-10 10:23发布

问题:

In the following array of 24 rows, there are 9 children (terminal nodes) - shaded yellow for clarity. In other words, every entry has a child except for the terminal nodes. For example, 5E has 2 two terminal nodes. 14G is a terminal node, but 15G is not. 16H is terminal. 17H has 2 children (terminal nodes). 22F also has 2 children (terminal nodes).

How to write an excel function or macro that identifies these terminal nodes?

回答1:

Given your data, the following conditional format seems to work. Select A1:I24, then use this CF formula:

=AND(A1<>"",OFFSET(A1,1,1)="")

Format with a yellow fill.

EDIT: Here is a screenshot of the CF dialog box, and the worksheet, for clarification: