jmaewyn
New Member
Hi! I'm stuck on how to add a unique value restriction to a sumproduct formula that already counts 2 text arrays according to different criteria.
The situation:
Counting # attendees at different event locations, each of whom have been identified by name plus their company name. Sometimes more than one person attended a given event from the same company. My formula so far is fine when I want to count the # individuals, however since I also want to count # companies I need to only count the unique company names.
The data:
3 columns containg text only, all defined as dynamic named ranges: Event.Locations, Attendees.Individuals, Attendees.Companies
The formula so far:
=SUMPRODUCT((Event.Locations="Sydney")*(Attendees.Individuals<>""))
NB the "Sydney" criteria here is an example, as I use a cell reference in the actual workbook, & the <>"" criteria has been used as the column contains text only.
This formula produces a correct result of (say) 14 individuals.
Currently when I switch Attendees.Individuals with Attendees.Companies I also get a result 14, as the formula is simply counting the non blank cells. However I know from my data that only (say) 10 companies were actually represented at the event.
I've tried adding /COUNTIF(Attendees.Companies,Attendees.Companies) in to the formula, as Chandoo has previously recommended this as part of a SUMPRODUCT for counting unique values (as have others).
I've placed the COUNTIF within the formula as follows:
=SUMPRODUCT((Attendee.Locations="Sydney")*((Attendee.Companies<>"")/COUNTIF(Attendee.Companies,Attendee.Companies)))
The result is not 10 (using the example numbers, the result is 7.7916...).
I'm obviously doing something wrong, but I can't find a better alternative to adding /COUNTIF to an existing SUMPRODUCT. I've read that FREQUENCY can only be used for numerical values, so I've not looked further into that, & I'm unsure how/whether to try INDEX or MATCH given the base formula is SUMPRODUCT.
Does anyone have any ideas?
NB I'd prefer to stay away from VBA as the report will be handed over to people with very little Excel experience.
Data can be provided if required.
The situation:
Counting # attendees at different event locations, each of whom have been identified by name plus their company name. Sometimes more than one person attended a given event from the same company. My formula so far is fine when I want to count the # individuals, however since I also want to count # companies I need to only count the unique company names.
The data:
3 columns containg text only, all defined as dynamic named ranges: Event.Locations, Attendees.Individuals, Attendees.Companies
The formula so far:
=SUMPRODUCT((Event.Locations="Sydney")*(Attendees.Individuals<>""))
NB the "Sydney" criteria here is an example, as I use a cell reference in the actual workbook, & the <>"" criteria has been used as the column contains text only.
This formula produces a correct result of (say) 14 individuals.
Currently when I switch Attendees.Individuals with Attendees.Companies I also get a result 14, as the formula is simply counting the non blank cells. However I know from my data that only (say) 10 companies were actually represented at the event.
I've tried adding /COUNTIF(Attendees.Companies,Attendees.Companies) in to the formula, as Chandoo has previously recommended this as part of a SUMPRODUCT for counting unique values (as have others).
I've placed the COUNTIF within the formula as follows:
=SUMPRODUCT((Attendee.Locations="Sydney")*((Attendee.Companies<>"")/COUNTIF(Attendee.Companies,Attendee.Companies)))
The result is not 10 (using the example numbers, the result is 7.7916...).
I'm obviously doing something wrong, but I can't find a better alternative to adding /COUNTIF to an existing SUMPRODUCT. I've read that FREQUENCY can only be used for numerical values, so I've not looked further into that, & I'm unsure how/whether to try INDEX or MATCH given the base formula is SUMPRODUCT.
Does anyone have any ideas?
NB I'd prefer to stay away from VBA as the report will be handed over to people with very little Excel experience.
Data can be provided if required.