title: VBA Multi-Criteria Parent-Child SumProduct
body: <p>Please help.</p>
  <p>I'm trying to create a user defined function that will use an array as multiple criteria (Pedigree) to check for corresponding parents (Parent) and then sum their respective ranges (Sumrange).</p>
  <p>I've managed to create code that will check if a parent is in the pedigree range which will then return a result of 1 or 0. This will not return true values if blanks verify blanks. I intend to create an array with these 1's and 0's to then SumProduct it with my Sumrange. My problem is that I am unable create an array of these 1's and 0's and SumProduct them with the Sumrange without returning a #value.</p>
  <p>This below code doesn't include the SumProduct portion but just returns 1 or 0 based on the criteria.</p>
  <pre><code>Function ProdIfs(Parent As Range, Pedigree As Range, Sumrange As Range) As Long
  Application.Volatile
  
  Dim i As Variant
  Dim j As Variant
  Dim result As Integer
      result = 0
  
  For Each i In Parent
  For Each j In Pedigree
      If i.Value = &quot;&quot; Or j.Value = &quot;&quot; Then
          result = result
          ElseIf i.Value = j.Value Then
          result = 1: GoTo NextIteration
      End If
  Next j
  NextIteration:
  Next i
  
  ProdIf = result
          
  End Function
  </code></pre>
  <p>Thanks for you help.</p>