title: VBA loop one cell upward until cell not equal "" and a cell incorporate two IF functions
body: <p>I'm totally new to VBA, am learning it by myself. Here is the problem:</p>
  
  <p><a href="http://i.stack.imgur.com/IbSOW.png" rel="nofollow">enter image description here</a></p>
  
  <p>So for Column E
  If B = "S" Then
  E = ""  // null</p>
  
  <p>If B = "F" Then
  E = (Reverse Rank x <strong>PREVIOUS</strong> Adjusted Rank + no of failure + 1)/(Reverse Rank + 1)</p>
  
  <p>or in formula excel format</p>
  
  <p>E5 = ((D5*E4)+($K$1+1))/(D5+1)</p>
  
  <p>So the problem lies on the PREVIOUS adjusted rank in the formula. Say, to get value of E5 it needs value of E4 BUT if E4 = "" so it has to go one cell upward. If one cell upward is also ="", it has to go one cell upward again until is not equal &lt;> "".</p>
  
  <p>The problem is I'm not sure what function is right to use. I think it would be IF and LOOP but I don't understand how to write the condition. Like I said I'm totally new and time constraints cause me anxiety.  Also, if you notice, for Column E there are two IFs function I suppose? One is E is depended on Column B.</p>
  
  <p>If Range("B2:B" &amp; lastRow) = "S" or "F" and one is if E="" or &lt;> ""</p>
  
  <p>How I incorporated with that?</p>