This is probably a simple fix (although me thinking this, means it probably isn't), so I apologise in advance if this is mere child's play.
In an excel sheet I am working on, I have a range (for the sake of this example is A1:A10) which can contain one of 3 variables (not including blanks) - A, B or C.
I require a formula in another cell to review the range in question and output a value based on the following rules in this priority:
- If A appears anywhere in the column, regardless of other inputs, display A;
- If B and C appear in the column, display A;
- If only B appears in the column, display B;
- If only C appears in the column, display C; and
- If all cells within the column are blank, display blank
For rules 1-4, any blank cells within the column should not be considered. It is only where all cells are blank, i.e. rule 5, that this should be considered.
I have tried IF formulas but have found these only consider a single cell. Also I have attempted using SUMPRODUCT along with IF but have hit a snag. The formula I used was:
IF(SUMPRODUCT(--(--(A1:A10="A")),"A",IF(SUMPRODUCT(--(A1:A10="B")),IF(SUMPRODUCT(--(A1:A10="C")),"A",IF(SUMPRODUCT(--(A1:A10="B")),"B",IF(SUMPRODUCT(--(A1:A10="C")),"C","")))))
Now I know this appears longwinded but until rule 3 it works fine. When trying for rule 4 or 5 the formula only returns FALSE
I'm all for the above formula being tweeked so that it works or for another formula entirely but I've tried searching everywhere and can't find anything on this (although this is probably down to me not phrasing my question/searches correctly).
Any help would be much appreciated. Thanks in advance!