Horizontal Analysis
Private Sub CommandButton1_Click()
Range("E2").Value = "Result"
Range("F2").Value = "Percentage"
last = Range("C" & Rows.Count).End(xlUp).Row
For i = 3 To last
If Cells(i, 3).Value = "" Then
ElseIf Cells(i, 3).Value <> "" Then
With Cells(i, 5)
.Value = Range("C" & i).Value - Range("D" & i).Value
.HorizontalAlignment = xlRight
Range("E" & i) = Format(Range("E" & i), "#,###")
Range("F" & i) = Range("E" & i) / Range("C" & i)
Range("F" & i).Select
Selection.NumberFormat = "0%"
If Range("D" & i).Value > Range("C" & i).Value Then
Union(Range("E" & i), Range("F" & i)).Font.ColorIndex = 3
End If
End With
End If
Next
Columns("E").AutoFit
End Sub