I can't see how to do what you are asking for without using VBa
Try this UDF
Option Explicit
Function SumProduceCustomer(rng As Range, strFruit As String, strCustomer As String)
Dim n As Long, ctr As Long
Dim Cell As Range
Dim arrFruit As Variant, arrCustomer As Variant
Application.Volatile
For Each Cell In rng
arrFruit = Split(Cell, Chr(10))
arrCustomer = Split(Cell.Offset(0, 1), Chr(10))
For n = 0 To UBound(arrFruit)
If InStr(1, arrFruit(n), strFruit) > 0 And InStr(1, arrCustomer(n), strCustomer) > 0 Then ctr = ctr + 1
Next
Next
SumProduceCustomer = ctr
End Function
When using this function specify the range by the first column only
e.g.
=SumProduceCustomer(A1:A3,"Apple","Brown")
or
=SumProduceCustomer(A1:A3,G4,H4)
This is entirely dependent on the adjacent cells in the list having the same number of lines (Alt+Enter) i.e. Chr(10) is used to split the data.
Hope this helps.
Bookmarks