Compare and count from multiple sheets

dininaus

New Member
Joined
Jul 27, 2016
Messages
22
Hi All,


Could someone please help me with the query below


I have 3 sheets Labels, Labels and Categories and Results. I have to check the all the values in Labels sheet against Labels and Categories sheet and report the total numbers in Result sheet. Please see example below.


Thanks in advance!

Labels sheet

Label1Label2Label3
123451234512345
1234121234
1234512345

<tbody>
</tbody>


Labels and Categories sheet

LabelCategory
12345A
1234B
12C

<tbody>
</tbody>


Results Sheet

CategoriesTotal Labels
A5
B2
C1

<tbody>
</tbody>

Thanks
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
with Power Query aka Get&Transform

Label1Label2Label3LabelCategoryCategoryCount
12345​
12345​
12345​
12345​
AA
5​
1234​
12​
1234​
1234​
BB
2​
12345​
12345​
12​
CC
1​

Code:
[SIZE=1]// Category
let
    Source = Excel.CurrentWorkbook(){[Name="Category"]}[Content]
in
    Source[/SIZE]

Code:
[SIZE=1]// Labels
let
    Source = Excel.CurrentWorkbook(){[Name="Labels"]}[Content],
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(Source, {}, "Attribute", "Value")
in
    #"Unpivoted Columns"[/SIZE]

Code:
[SIZE=1]// Merge1
let
    Source = Table.NestedJoin(Category,{"Label"},Labels,{"Value"},"Labels",JoinKind.LeftOuter),
    #"Expanded Labels" = Table.ExpandTableColumn(Source, "Labels", {"Attribute", "Value"}, {"Attribute", "Value"}),
    #"Grouped Rows" = Table.Group(#"Expanded Labels", {"Category"}, {{"Count", each Table.RowCount(_), type number}})
in
    #"Grouped Rows"[/SIZE]
 
Upvote 0

Excel 2016
ABC
1Label1Label2Label3
2123451234512345
31234121234
41234512345
Labels



Excel 2016
AB
1LabelCategory
212345A
31234B
412C
Labels & Categories


B2 copied down


Excel 2016
AB
1CategoriesTotal Labels
2A5
3B2
4C1
Results
Cell Formulas
RangeFormula
B2=COUNTIF(Labels!$A$2:$C$4,INDEX('Labels & Categories'!$A$2:$A$4,MATCH(A2,'Labels & Categories'!$B$2:$B$4,0)))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,429
Messages
6,119,424
Members
448,896
Latest member
MadMarty

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