title: ExcelVBA If SumA > SumB or Sum C then "G" HOW?
body: <p>I'm quite new to excel vba and this is what i wrote to satisfy the following condition</p>
  
  <ul>
  <li>sumA greater than sumB or sumC then "G"</li>
  <li>sumB greater than sumA or sumC then "Y"</li>
  <li>sumC greater than sumA or sumB then "R"</li>
  </ul>
  
  <p>within the range of gr,yr,rr cells are numbers that I will be manually inputting.</p>
  
  <pre><code>Dim gr As Range
  Dim yr As Range
  Dim rr As Range
  Dim gr1 As Long
  Dim yr1 As Long
  Dim rr1 As Long
  Dim overallrisk As Range
  
  Set overallrisk = Sheets("Dashboard").Range("C24")
  Set gr = Sheets("Dashboard").Range("C30:C32").Range("C33:C35").Range("D33:D35")
  Set yr = Sheets("Dashboard").Range("C27:C29").Range("D30:D32").Range("E33:E35")
  Set rr = Sheets("Dashboard").Range("D27:D29").Range("E27:E29").Range("E30:E32")
  
  gr1 = Application.WorksheetFunction.Sum(gr)
  yr1 = Application.WorksheetFunction.Sum(yr)
  rr1 = Application.WorksheetFunction.Sum(rr)
  
  If gr1 &gt; yr1 Or rr1 Then
      overallrisk = "G"
  ElseIf yr1 &gt; gr1 Or rr1 Then
      overallrisk = "Y"
  ElseIf rr1 &gt; yr1 Or gr1 Then
      overallrisk = "R"
  End If
  </code></pre>
  
  <p>I didn't get any errors so I thought it would work but the "overallrisk" cell is still blank even though I put numbers in the range of cells. </p>
  
  <p>Thank you!</p>