How to isolate mutually exclusive rows?

canyon

New Member
Joined
Jan 5, 2022
Messages
24
Office Version
  1. 2019
Platform
  1. Windows
I have a dataset with over 690,000 rows of the various parts and components for my companies vehicles and their variants. Right now I am trying to isolate the parts that are unique to a particular variant... is there an easy way to do this in PQ or excel?
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Capture.JPG


Image added for clarity.
 
Upvote 0
Hi! I'm not typing your data by hand so I made up some sample data instead.
variantid
van1
van2
truck3
truck4
motorcycle5
motorcycle6
car7
car7
van9
truck3
motorcycle5
car10
car10

Excel 365 and 2021 can make use of dynamic array functions which make this muuuuch easier.
Excel Formula:
=UNIQUE(FILTER(Table7[id],Table7[variant]="car"))
yields
7
10

Looks like you are not using those versions though, so Power Query is going to be your better bet in my opinion (it's otherwise doable with the other regular excel functions, but it might be a bit complex).
Load the table into PQ, and then filter for variant = car and then remove duplicated on the id column.
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table7"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"variant", type text}, {"id", Int64.Type}}),
    #"Filtered Rows variant = car" = Table.SelectRows(#"Changed Type", each ([variant] = "car")),
    #"Removed Duplicates from id" = Table.Distinct(#"Filtered Rows variant = car", {"id"})
in
    #"Removed Duplicates from id"
yields
variantid
car7
car10
 
Upvote 0

Forum statistics

Threads
1,223,671
Messages
6,173,737
Members
452,532
Latest member
cnetctg

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top