Answers.Body: <p>Welcome to SE.  I can reproduce that and it seems to be a bug so have logged it as an <a href="https://lab.civicrm.org/dev/core/-/issues/2997" rel="nofollow noreferrer">issue</a>.  However, I'd suggest you look at Search Kit rather than Search Builder. See <a href="https://dmaster.demo.civicrm.org/civicrm/admin/search#/create/Contact?params=%7B%22version%22:4,%22select%22:%5B%22id%22,%22display_name%22%5D,%22orderBy%22:%7B%7D,%22where%22:%5B%5B%22groups:name%22,%22IN%22,%5B%22Advisory%20Board%22%5D%5D,%5B%22groups:name%22,%22NOT%20IN%22,%5B%22Newsletter%20Subscribers%22%5D%5D%5D,%22groupBy%22:%5B%5D,%22join%22:%5B%5D,%22having%22:%5B%5D%7D" rel="nofollow noreferrer">this</a></p>
  <p><a href="https://i.sstatic.net/kVzw6.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/kVzw6.png" alt="enter image description here" /></a></p>
  <p>One of the many nice things about Search Kit is that you can expand the Query Info section to see how your GUI entry is being interpreted.  Search Builder doesn't give you any info to help figure out why it's not showing the results you expect.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-12-17T11:27:35.000Z
Answers.LastActivityDate: 2021-12-17T11:27:35.000Z
Answers.UserDisplayName: Aidan
Body: <p>This was run on your demo account using Search Builder. All the records selected are in both groups.
  8 Contacts<br />
  Group(s) <strong>In</strong> Advisory Board ...AND...
  Group Status 'Added' ...AND...
  Group(s) <strong>Not In</strong> Newsletter Subscribers ...AND...
  Group Status 'Added'
  Select Records:  All 8 records    0 Selected records only</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-12-15T02:25:51.897Z
Comments.Text: more of a sidestep than an answer, but in case you don't know of its existence - under Search > Custom search, and there is an include/exclude which works for groups or tags https://dmaster.demo.civicrm.org/civicrm/contact/search/custom?csid=4&reset=1
Comments.UserDisplayName: petednz - fuzion
Tags: <search><search-builder><searchkit>
Title: Search builder fails In Group and Not In Group Search
ThreadText: # Search builder fails In Group and Not In Group Search
  
  (Asked by: username_0 on 2021-12-15)
  
  This was run on your demo account using Search Builder. All the records selected are in both groups.
  8 Contacts  
  Group(s) **In** Advisory Board ...AND...
  Group Status 'Added' ...AND...
  Group(s) **Not In** Newsletter Subscribers ...AND...
  Group Status 'Added'
  Select Records: All 8 records 0 Selected records only
  
  **Tags:** search, search-builder, searchkit
  
  > **Comments:**
  > **username_1**: more of a sidestep than an answer, but in case you don't know of its existence - under Search > Custom search, and there is an include/exclude which works for groups or tags https://dmaster.demo.civicrm.org/civicrm/contact/search/custom?csid=4&reset=1  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2021-12-17. Score: 1
  
  Welcome to SE. I can reproduce that and it seems to be a bug so have logged it as an [issue](https://lab.civicrm.org/dev/core/-/issues/2997). However, I'd suggest you look at Search Kit rather than Search Builder. See [this](https://dmaster.demo.civicrm.org/civicrm/admin/search#/create/Contact?params=%7B%22version%22:4,%22select%22:%5B%22id%22,%22display_name%22%5D,%22orderBy%22:%7B%7D,%22where%22:%5B%5B%22groups:name%22,%22IN%22,%5B%22Advisory%20Board%22%5D%5D,%5B%22groups:name%22,%22NOT%20IN%22,%5B%22Newsletter%20Subscribers%22%5D%5D%5D,%22groupBy%22:%5B%5D,%22join%22:%5B%5D,%22having%22:%5B%5D%7D)
  
  [![enter image description here](https://i.sstatic.net/kVzw6.png)](https://i.sstatic.net/kVzw6.png)
  
  One of the many nice things about Search Kit is that you can expand the Query Info section to see how your GUI entry is being interpreted. Search Builder doesn't give you any info to help figure out why it's not showing the results you expect.
  
  
  ---
  
  