HansSchulze
New Member
- Joined
- Jul 27, 2017
- Messages
- 4
The Countif below should read something like
to concatenate the two fields for the search. Unfortunately, MPN table columns are A and D are not consecutive.
Thanks for your help in advance.
Code:
...partNumber & companyName, Range("MPN!PDPMPN[MFR_PART_NUMBER] & Range("MPN!PDPMPN[ORGANIZATION_NAME")
Code:
Dim company As Variant, rDataMart As Range, rDataMart2, where As Variant
Set rDataMart = ThisWorkbook.Worksheets("MPN").Range("MPN!PDPMPN[MFR_PART_NUMBER]")
Set rDataMart2 = ThisWorkbook.Worksheets("MPN").Range("MPN!PDPMPN[ORGANIZATION_NAME]")
GetNearestCompany = ""
For Each company In NameArray
where = Application.CountIfs(rDataMart, MPN, rDataMart2, company) ' still not working
If where Then
If GetNearestCompany = Empty Then
Debug.Print "Found", MPN, company, where
GetNearestCompany = where
Else
Debug.Print "Dup", MPN, company, GetNearestCompany, where
End If
End If
Next company
If GetNearestCompany = Empty Then
Debug.Print "NF", MPN, company
End If
Thanks for your help in advance.