title: excel formula to give the priority to a value from a range of values in a column
body: <p>This is probably a simple fix (although me thinking this, means it probably isn't), so I apologize in advance if this is mere child's play.</p>
  
  <p>In an excel sheet I am working on, I have a range (for the sake of this example is B1:B10) which can contain one of 5 variables (not including blanks) - OG, D, L, PP or C.</p>
  
  <p>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:</p>
  
  <ol>
  <li>If OG appears anywhere in the column, regardless of other inputs, display OG;</li>
  <li>If D and L and/or PP and/or C appear in the column, display OG;</li>
  <li>If only D appears in the column, display D;</li>
  <li>If only PP appears in the column, display PP;</li>
  <li>If only L appears in the column, display L;</li>
  <li>If only C appears in the column, display C; and</li>
  <li>If all cells within the column are blank, display blank</li>
  </ol>
  
  <p>For rules 1-6, any blank cells within the column should not be considered. It is only where all cells are blank, i.e. rule 7, that this should be considered.</p>
  
  <p>I have tried IF formulas but have found these only consider a single cell. 
  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).</p>
  
  <p>Any help would be much appreciated. Thanks in advance!</p>