title: GoogleSheets QUERY Formula Grouping
body: <p>Having some trouble with this sucker. Trying to use QUERY function but want to exclude Column D from grouping. Data I'm hoping to see in each respective column of QUERY table: </p>
  
  <ul>
  <li>Unique (non-duplicated) Names</li>
  <li>Most Recent Move-In Date</li>
  <li>Most Recent Check Date among those corresponding to "Most Recent Move-In Date" for each unique name</li>
  <li>Check Amount Corresponding to that "Most Recent Check Date"</li>
  </ul>
  
  <pre>
  =QUERY(
    A:D,
    "select A,B, max(C), D where not B is null group by A,B,D label A 'Client Name',
      B 'Move-In Date',max(C) 'Check Date',D 'Amount'"
  )
  </pre>
  
  <p>What I've figured out so far is that including "Column D" in "group by" causes duplicate Names to appear, but without including that column in "group by" I get a "#VALUE!" error. </p>
  
  <p>See link for sample data with examples: <a href="https://docs.google.com/spreadsheets/d/1CJKiDNPUWMMUbLLb-UDA6iRA2PBnlMHDsEB9vELe0Rk/edit?usp=sharing" rel="nofollow">Data Test</a></p>