title: Create a countIfs function that ignores cells with text that has been struck through
body: <p>Searching through the internet I was able to find some code that creates a countIf function that will not count a cell if there is strikethrough text in it.</p>
  
  <pre><code>Function MyCountif(rng As Range, s As String)
  Application.Volatile
  Dim i As Long, s1 As String, cell As Range
  If Len(s) &lt;&gt; 1 Then
    MyCountif = CVErr(xlErrValue)
    Exit Function
  End If
  For Each cell In rng
    For i = 1 To Len(cell.Text)
      s1 = Mid(cell.Text, i, 1)
      If LCase(s1) = LCase(s) Then
        If cell.Characters(i, 1).Font.Strikethrough = False Then
           MyCountif = MyCountif + 1
        End If
      End If
    Next
  Next
  End Function
  </code></pre>
  
  <p>I was wondering if it was possible to make a similar function but instead in the form of a countIfs function that can also ignore the strikethrough text.</p>
  
  <p>Edit: I don't have a ton of vba experience but I did give it a try myself. Since what I need it for will only need two ranges and two criteria I tried to put together something that ran the original function twice and if both criteria were met it would raise the count by one but I haven't quite gotten it to work.</p>
  
  <pre><code>Function MyCountif(rng As Range, s As String, rng2 As Range, p As String)
  Application.Volatile
  Dim i As Long, numbers(3) As Integer, numbers2(3) As Integer, s1 As String, cell As Range, j As Long, p1 As String, cell2 As Range, first As Long, second As Long
  If Len(s) &lt;&gt; 1 Then
    MyCountif = CVErr(xlErrValue)
    Exit Function
  End If
  For Each cell In rng
    For i = 1 To Len(cell.Text)
      s1 = Mid(cell.Text, i, 1)
      If LCase(s1) = LCase(s) Then
        If cell.Characters(i, 1).Font.Strikethrough = False Then
           numbers(i) = 1
        End If
      End If
    Next
  Next
  For Each cell2 In rng2
    For i = 1 To Len(cell2.Text)
      p1 = Mid(cell2.Text, i, 1)
      If LCase(p1) = LCase(p) Then
        If cell.Characters(i, 1).Font.Strikethrough = False Then
           numbers2(i) = 1
        End If
      End If
    Next
  Next
  For i = 0 To 3
      If numbers(i) = 1 And numbers2(i) = 1 Then
          MyCountif = MyCountif + 1
      End If
  Next
  End Function
  </code></pre>