title: Formula with IF statement and condition
body: <p>I am trying to use an excel formula to determine the proportion (<code>pDistance</code>) of the total <code>Distance</code> for each <code>Position</code> by <code>Site</code>.  For example if the (total) <code>Distance</code> was 50 and the <code>Position</code> was 10 the proportion of the total distance (<code>pDistance</code>) would be 0.2, the last <code>pDistance</code> of any <code>Site</code> should always be 1.  The formula I used (<code>=IF(B3&lt;B2, 1, (B2/C2))</code>) mostly works, except that I have some values of <code>Position</code> that are -10.  </p>
  
  <p>In these cases every <code>Position</code> in that <code>Site</code> should have a value of 10 added to it before calculating the <code>pDistance</code>. Can this be done with one formula, that is calculate the <code>pDistance</code> and add 10 when necessary?  Or would it be best to make a dummy column first?  If creating a dummy column is the way to go, how does one use formula to do something until a condition is met (e.g. add 10 the <code>Position</code> until a 0 , or new <code>Site</code>, is reached)?</p>
  
  <p><img src="https://i.stack.imgur.com/Bgo5y.jpg" alt="excel 2013 screenshot of if statement with want of conditional statement"></p>