Google-sheets – Collates the number of depots that don’t have manifests and trunk headers

formulasgoogle sheetsgoogle-sheets-arrayformulagoogle-sheets-queryvlookup

Trying to do a work project that collates the number of depots that don't have manifests and trunk headers.

  • Column A: Depot Numbers
  • Column B: No Manifest record (i.e if Colum B 2 – 200 contains "value x" then means no manifest)
  • Column C: Same as column B but for Trunk Headers instead of Manifests

  • Column D: List of Depot numbers in numerical order (2 – 200)

  • Column E: Collated total of "no manifests" from column B "cells 2 – 200" if column A collates with the relevant Depot Number (i.e Column D4 will be Depot 3 and E4 will show the total number of Depot 3's that don't have manifests collated from Column A and B (column A is depot number & column B is no manifest))
  • Column F: Same as Column E but for No Trunk Header instead of No Manifest.

Can someone please assist as I'm not sure if I need REGEXMATCH or something else.

Best Answer

=ARRAYFORMULA(IFERROR(VLOOKUP($C$2:$C, QUERY({A2:A}, 
 "select Col1,count(Col1) 
  where Col1 is not null 
  group by Col1 
  label count(Col1)''"), 2, 0)))

0

demo spreadsheet