title: VBA: Excel evaluating incorrectly
body: <p>I have been hitting my head against the wall on why excel is evaluating something like 4 > 0 to be false...</p>
  
  <p>In vba I am applying the following R1C1 forumla:</p>
  
  <pre><code>=IF(AND(RC[-5]&gt;R1C15,RC[-4]&gt;2*R1C15,RC[-3]&gt;3*R1C15),""CORE"",""-"")
  </code></pre>
  
  <p>which when the macro is run, turns into:</p>
  
  <pre><code>=IF(AND(I2&gt;$O$1,J2&gt;2*$O$1,K2&gt;3*$O$1),"CORE","-")
  </code></pre>
  
  <p>However, if we look at the screenshot of at row 2
  I2, J2, K2, are all set to the value of 4 which is greater than O1 value of 0, but excel evaluates it as false.</p>
  
  <p><a href="https://i.stack.imgur.com/gf0p0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gf0p0.png" alt="enter image description here"></a></p>
  
  <p>Why? Both the fields are formatted as numbers?</p>
  
  <p>full vba snippet:</p>
  
  <pre><code>Public Sub FormatCore()
      Rows("1:1").Select
      With ActiveWindow
      Range("B2").Select
      ActiveWindow.FreezePanes = False
      ActiveWindow.FreezePanes = True
      End With
      Range("N2").Select
      Application.CutCopyMode = False
      ActiveCell.FormulaR1C1 = "=IF(AND(RC[-5]&gt;R1C15,RC[-4]&gt;2*R1C15,RC[-3]&gt;3*R1C15),""CORE"",""-"")"
      Range("N3").Select
      Range("N2").Select
      Dim total_rows As Double
      total_rows = Worksheets("Report").Cells(Worksheets("Report").Rows.Count, "A").End(xlUp).Row
      Selection.AutoFill Destination:=Range("N2: N" &amp; total_rows)
  End Sub
  </code></pre>