title: Excel VBA SUMIF Run-time error '424': Object Required
body: <p>This produces an Error: Run-time error '424': Object Required</p>
  
  <pre><code>Private Function Y_Mode() As Double
      Dim MaxGrad As Double
      MaxGrad = WorksheetFunction.Max(Graduation_Series)
      Y_Mode = WorksheetFunction.SumIf(Graduation_Series, MaxGrad, Y_Series)
  End Function
  </code></pre>
  
  <p>It is failing on this line:</p>
  
  <pre><code>Y_Mode = WorksheetFunction.SumIf(Graduation_Series, MaxGrad, Y_Series)
  </code></pre>
  
  <p>Everything seems defined and instantiated properly and the elements of each array are of type Variant/Double</p>
  
  <pre><code>Watch : + :     Graduation_Series :  : Variant/Variant(0 to 14) : SU_Solution.Y_Mode
  Watch :   :     MaxGrad : 474.281204765715 : Double : SU_Solution.Y_Mode    
  Watch : + :     Y_Series :  : Variant/Variant(0 to 14) : SU_Solution.Y_Mode
  </code></pre>
  
  <p>I tried putting MaxGrad into a Range and then referencing the Range in SUMIF, but that did not work either.</p>