Grouping values in table

excelos

Well-known Member
Joined
Sep 25, 2011
Messages
592
Office Version
  1. 365
Platform
  1. Windows
Hello

I have this data:



Property1Property2Property3Property4
Record1
1​
2​
3​
4​
Record2
2​
3​
4​
5​
Record3
3​
4​
5​
6​
Record4
4​
5​
6​
7​
Record5
5​
6​
7​
8​

I would like to group it based on the following criteria:

Group1Property2>3 and Property3>5
Group2Property2>4 and Property4>6

You will notice that some records may belong to more than one groups.

What is the right format to be able to pivot the data so that I show:

Count
Group1
2​
Group2
1​

I was thinking to create a new column in the first table called Group and calculate if a record belongs to Group1 or Group2 but the problem is that a record may belong to more than one groups. Using TEXTJOIN would be problematic and would prevent pivoting.
Creating two new columns in the first table called Group1 and Group2 and populate them with Y/N would be very tedious if the groups are too many.

Any idea?

Thanks!
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Hi, just a question, what is the identifier for 'groups' in your data? You mentioned Group 1 with a count of 2 and Group2 with a count of 1.
This might help others.
 
Upvote 0
These are the criteria for the Grouping:

Group1Property2>3 and Property3>5
Group2Property2>4 and Property4>6
 
Upvote 0
Creating two new columns in the first table called Group1 and Group2 and populate them with Y/N would be very tedious if the groups are too many.
If you're ok to use macro, I think I can write a macro to do that
 
Upvote 0
Thanks but I am rather looking for the output format rather than how to achieve the format.

I.e. an output format like the below does not allow pivoting to achieve the final table (shown last):
Property1Property2Property3Property4Group1Group2
Record11234NN
Record22345NN
Record33456NN
Record44567YY
Record55678YY

Count
Group12
Group21
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,270
Members
452,628
Latest member
dd2

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