Search code examples
google-sheetsgoogle-sheets-formula

Query Multiple Named Ranges but don't include blank cells


I have a Google Sheets Formula that is combining data from 15 named ranges as follows;

=UNIQUE({USMTD; UKMTD; DEMTD; JPMTD; FRMTD; ITMTD; ESMTD; CAMTD; MXMTD; ANZMTD; BRMTD; COMTD; CLMTD; ARMTD; INMTD})

However the output has a blank row after every range (example shown below);

Black Row Example

I browsed through Stack Overview and came across a few posts, including;

Spreadsheets get unique names but ignore blank cells

But when I change the formula as suggested in an answer in the above link to;

=UNIQUE(FILTER({USMTD; UKMTD; DEMTD; JPMTD; FRMTD; ITMTD; ESMTD; CAMTD; MXMTD; ANZMTD; BRMTD; COMTD; CLMTD; ARMTD; INMTD},{USMTD; UKMTD; DEMTD; JPMTD; FRMTD; ITMTD; ESMTD; CAMTD; MXMTD; ANZMTD; BRMTD; COMTD; CLMTD; ARMTD; INMTD})<>"")

I then get an error message: Error FILTER range must be a single row or a single column.

Is there another way to remove the blank rows / cells with my named ranges?

Thanks in advance


Solution

  • You can try a QUERY() formula.

    How about something like this?

    =UNIQUE(QUERY({USMTD; UKMTD; DEMTD; JPMTD; FRMTD; ITMTD; ESMTD; CAMTD; MXMTD; ANZMTD; BRMTD; COMTD; CLMTD; ARMTD; INMTD},"Select * where Col1 is not null")