SELECT Customer, code, policy No
FROM My Table
WHERE Customer NOT IN (SELECT DISTINCT Customer WHERE Carrier <>'West Business')
SELECT *
FROM YourTable AS t1
WHERE EXISTS ( SELECT 1
FROM (SELECT [Account Name],[Cust No],
COUNT(*) Cnt,
SUM(IIF([Parent Co] LIKE 'West Bend%',1,0)) Sum_Parent
FROM (SELECT DISTINCT [Account Name],[Cust No],[Parent Co]
FROM YourTable) AS t2
GROUP BY [Account Name],[Cust No]) AS t3
WHERE Parent_Sum = 1 AND Cnt = 1
AND t1.[Account Name] = t3.[Account Name]
AND t1.[Cust No] = t3.[Cust No])
The formula counts the number of lines that have that customer number and are not equal to West. I've used D2 cause West was in there, you could hard code it to
=COUNTIFS($A$2:$A$15,A2,$D$2:$D$15,"<>West Business")
SELECT Small_Commercial_Buckets.[Account Name], Small_Commercial_Buckets.[Cust No], Small_Commercial_Buckets.[Policy No], Small_Commercial_Buckets.[Pol Exec], Small_Commercial_Buckets.[Pol Rep], Small_Commercial_Buckets.[Commission], Small_Commercial_Buckets.[Premium], Small_Commercial_Buckets.[Market], Small_Commercial_Buckets.[Parent Co], Small_Commercial_Buckets.[Policy Status]
FROM Small_Commercial_Buckets
WHERE Small_Commercial_Buckets.[Account Name] NOT IN (SELECT DISTINCT Small_Commercial_Buckets.[Account Name] WHERE Small_Commercial_Buckets.[Parent Co] <>' West Bend Mutual Ins. Co.') ;
SELECT Small_Commercial_Buckets.[Account Name],
Small_Commercial_Buckets.[Cust No],
Small_Commercial_Buckets.[Policy No],
Small_Commercial_Buckets.[Pol Exec],
Small_Commercial_Buckets.[Pol Rep],
Small_Commercial_Buckets.[Commission],
Small_Commercial_Buckets.[Premium],
Small_Commercial_Buckets.[Market],
Small_Commercial_Buckets.[Parent Co],
Small_Commercial_Buckets.[Policy Status]
FROM Small_Commercial_Buckets
WHERE EXISTS ( SELECT 1
FROM (SELECT Small_Commercial_Buckets.[Account Name],Small_Commercial_Buckets.[Account Name],
COUNT(Small_Commercial_Buckets.[Account Name]) cnt,
SUM(IIF([Small_Commercial_Buckets.[Parent Co]) LIKE 'West Bend%',1,0)) Sum_Parent)
FROM (SELECT DISTINCT Small_Commercial_Buckets.[Account Name],Small_Commercial_Buckets.[Cust No],Small_Commercial_Buckets.[Parent Co]
FROM Small_Commercial_Buckets) AS t2
GROUP BY Small_Commercial_Buckets.[Account Name],Small_Commercial_Buckets.[Cust No]) AS t3
WHERE Parent_Sum = 1 AND Cnt = 1
AND t1.[Account Name] = t3.[Account Name]
AND t1.[Cust No] = t3.[Cust No])
=COUNTIFS($A$2:$A$15,A2,$D
Thomas