title: VBA basic algorithm doesn't work
body: <p>I have a risk heat map in excel. I have  a formula that should take the probability and impact of each reference and place it in an appropriate cell in the table. It looks like this:</p>
  
  <pre><code>Function ProbSevScore(Prob As Integer, Sev As Integer, Nbr As Range)
  Application.Volatile True
  Dim cell As Range
  
  ProbSevScore = ""
  
  For Each cell In Nbr
  PScore = Right(cell.Offset(0, 1), 1) + 0
  SScore = Right(cell.Offset(0, 2), 1) + 0
  If PScore = Prob Then
  If SScore = Sev Then
  If Len(ProbSevScore) &gt; 0 Then
  ProbSevScore = ProbSevScore &amp; ","
  End If
  ProbSevScore = ProbSevScore &amp; cell.Value
  End If
  End If
  Next cell
  
  End Function
  </code></pre>
  
  <p>It is a copy of the algorithm outlined in this tutorial video: <a href="https://www.youtube.com/watch?v=_XqCX4pKFPM" rel="nofollow noreferrer">https://www.youtube.com/watch?v=_XqCX4pKFPM</a></p>
  
  <p>I have some slight differences in my map, the probability and severity are called different things and the axis are reversed but these things are not important.</p>
  
  <p>When I try to use this formula, nothing appears in the cell that I run the function in. It is left blank, no #VALUE error or anything.</p>
  
  <p>What am I doing wrong? Have I copied the code incorrectly? The algorithm works in the video! Does this code work for you guys? </p>
  
  <p>Me calling function: <img src="https://i.stack.imgur.com/t8AMx.png" alt="enter image description here"></p>
  
  <p>Document: <a href="https://www.sendspace.com/file/liw29j" rel="nofollow noreferrer">https://www.sendspace.com/file/liw29j</a></p>