I'm trying to create a list of items which do NOT have a row containing a specific value in it.
Example: I would like to pivot on the below table to show me only a list of the rooms that do NOT have a TV in the Equipment column. If successful, my list would only contain room numbers 102 and 104.
I've tried using the Pivot Table filters, however if I exclude TV from the Equipment column, the list still includes Rooms 101 and 103 due to there being rows with other equipment present. I've tried searching for a solution online however I'm not quite sure how best to word this question..!
Room Number | Equipment |
---|---|
101 | TV |
101 | Coffee Machine |
101 | Kettle |
102 | Coffee Machine |
102 | Kettle |
103 | TV |
103 | Kettle |
103 | Coffee Machine |
103 | Desk Lamp |
104 | Kettle |
104 | Desk Lamp |
Any guidance would be appreciated.
Using POWER QUERY
will be more apt here as it can handle quite a lot amount of datasets, so to achieve this using the said procedure, follow these simple steps using POWER QUERY window UI
:
Table_1
let
Source = Excel.CurrentWorkbook(){[Name="Table_1"]}[Content],
GroupRows = Table.Group(Source, {"Room Number"}, {{"Count", each _, type table [Room Number=number, Equipment=text]}}),
Counts = Table.AddColumn(GroupRows, "Custom", each Table.RowCount(Table.SelectRows([Count], each ([Equipment] = "TV")))),
ExpandColumns = Table.ExpandTableColumn(Counts, "Count", {"Equipment"}, {"Equipment"}),
FilterBy0 = Table.SelectRows(ExpandColumns, each [Custom] = 0),
ExcludeUnwantedCols = Table.RemoveColumns(FilterBy0,{"Custom"})
in
ExcludeUnwantedCols
Alternatively, as commented above using Excel Formulas
I would have opted using FILTER()
and COUNTIFS()
Functions respectively.
=FILTER(A2:B12,COUNTIFS(A2:A12,A2:A12,B2:B12,"TV")=0)