title: How to use operator in MAXIFS VBA EXCEL
body: <p>Hope someone can help me. My main issue is to get the “&gt;=” part to work in the Application.WorksheetFunction.MaxIfs function in VBA.</p>
  <p>I have a table with:</p>
  <ul>
  <li>One header row</li>
  <li>125 rows of data</li>
  <li>Three columns: Time, Amount and Order ID</li>
  </ul>
  <p><a href="https://i.stack.imgur.com/u0xbT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u0xbT.png" alt="See the following picture of the data" /></a></p>
  <p>I have three items (Order IDs) in a collection, collOrderID, which I loop over later.
  Also, I set three ranges corresponding to the three columns in the table and assign a date and time to the variable dtClosingTime.</p>
  <p>My objective when looping through the items in the collOrderID is to get the maximum amount if 1) the Order ID matches the current Order ID in the collection we are looking at and if 2) the Time is greater than or equal to dtClosingTime.</p>
  <p>Please see the code below.</p>
  <pre><code>Sub test()
      Dim collOrderID As New Collection
      Dim item As Variant
      Dim dtClosingTime As Date
      Dim rngTimeAuction As Range
      Dim rngAmountAuction As Range
      Dim rngOrderIDAuction As Range
      Dim intAmountInAuction As Integer
      
      'Add three items to collection
      collOrderID.Add 210481095
      collOrderID.Add 211145007
      collOrderID.Add 74163756
      
      'Set ranges
      Set rngTimeAuction = ThisWorkbook.Worksheets(&quot;Sheet1&quot;).Range(&quot;B8:B132&quot;)
      Set rngAmountAuction = ThisWorkbook.Worksheets(&quot;Sheet1&quot;).Range(&quot;C8:C132&quot;)
      Set rngOrderIDAuction = ThisWorkbook.Worksheets(&quot;Sheet1&quot;).Range(&quot;D8:D132&quot;)
      
      'Assign closing time
      dtClosingTime = ThisWorkbook.Worksheets(&quot;Sheet1&quot;).Range(&quot;D2&quot;)
      
      For Each item In collOrderID
              'Compute amount: Must be orderID in collection and later than dtClosingTime
              intAmountInAuction = Application.WorksheetFunction.MaxIfs(rngAmountAuction, rngOrderIDAuction, item, rngTimeAuction, &quot;&gt;=&quot; &amp; dtClosingTime)
              
              'Show answer
              MsgBox intAmountInAuction
      Next item
  End Sub
  </code></pre>
  <p>When executing this code, I would expect to get three message boxes with the three green values, i.e. 4822, 6498 and 5400, in that order, but instead I get three 0s (Please see the snapshot I have attached).</p>
  <p>I am quite confident that it has something to do with the “&gt;=” part of the MaxIfs function, as I have also tried matching with just the dtClosingTime and then changing one of the Time values to dtClosingTime to see that I get the right result.</p>
  <p>Does anyone know what I am missing here?</p>