Formula Required to Group Family Members, where ID matches

WednesdayC

Board Regular
Joined
Nov 7, 2010
Messages
201
Office Version
  1. 2016
Platform
  1. MacOS
<style>table { }td { padding-top: 1px; padding-right: 1px; padding-left: 1px; color: black; font-size: 10pt; font-weight: 400; font-style: normal; text-decoration: none; font-family: Georgia, sans-serif; vertical-align: bottom; border: medium none; white-space: nowrap; }.xl63 { font-family: Calibri, sans-serif; }.xl64 { color: black; font-family: Verdana; text-align: right; border: 0.5pt solid rgb(170, 170, 170); }.xl65 { color: black; font-family: Verdana; text-align: left; border: 0.5pt solid rgb(170, 170, 170); }.xl66 { font-weight: 700; font-family: Calibri, sans-serif; }.xl67 { font-weight: 700; font-family: Calibri, sans-serif; text-align: center; }.xl68 { color: black; font-weight: 700; font-family: Verdana; text-align: left; border: 0.5pt solid rgb(170, 170, 170); }</style>Hi All

Can anyone help me please? I am trying to group family members, as follows:-

[TABLE="width: 477"]
<colgroup><col style="width:75pt" width="75" span="4"> <col style="mso-width-source:userset;mso-width-alt:6473;width:177pt" width="177"> </colgroup><tbody>[TR]
[TD="class: xl65, width: 75"]ID[/TD]
[TD="class: xl65, width: 75"]LAST NAME[/TD]
[TD="class: xl65, width: 75"]FIRST NAME[/TD]
[TD="class: xl66, width: 75"]Status[/TD]
[TD="class: xl67, width: 177"]RESULTS REQUIRED[/TD]
[/TR]
[TR]
[TD="class: xl68"]84[/TD]
[TD="class: xl69"]Doe[/TD]
[TD="class: xl69"]Joe[/TD]
[TD="class: xl69"]Employee[/TD]
[TD="class: xl70"]EMPLOYEE[/TD]
[/TR]
[TR]
[TD="class: xl68"]88[/TD]
[TD="class: xl69"]Smith[/TD]
[TD="class: xl69"]Alan[/TD]
[TD="class: xl69"]Employee[/TD]
[TD="class: xl70"]EMPLOYEE[/TD]
[/TR]
[TR]
[TD="class: xl68"]192[/TD]
[TD="class: xl69"]Jones[/TD]
[TD="class: xl69"]Jack[/TD]
[TD="class: xl69"]Employee[/TD]
[TD="class: xl70"]EMPLOYEE, SPOUSE + 3 CHILDREN[/TD]
[/TR]
[TR]
[TD="class: xl68"]192[/TD]
[TD="class: xl69"]Jones[/TD]
[TD="class: xl69"]Emma[/TD]
[TD="class: xl69"]spouse[/TD]
[TD="class: xl70"] [/TD]
[/TR]
[TR]
[TD="class: xl68"]192[/TD]
[TD="class: xl69"]Jones[/TD]
[TD="class: xl69"]John[/TD]
[TD="class: xl69"]child[/TD]
[TD="class: xl70"] [/TD]
[/TR]
[TR]
[TD="class: xl68"]192[/TD]
[TD="class: xl69"]Jones[/TD]
[TD="class: xl69"]Jane[/TD]
[TD="class: xl69"]child[/TD]
[TD="class: xl70"] [/TD]
[/TR]
[TR]
[TD="class: xl68"]192[/TD]
[TD="class: xl69"]Jones[/TD]
[TD="class: xl69"]Jessica[/TD]
[TD="class: xl69"]child[/TD]
[TD="class: xl70"] [/TD]
[/TR]
[TR]
[TD="class: xl68"]195[/TD]
[TD="class: xl69"]Davies[/TD]
[TD="class: xl69"]Mark[/TD]
[TD="class: xl69"]Employee[/TD]
[TD="class: xl70"]EMPLOYEE[/TD]
[/TR]
[TR]
[TD="class: xl68"]197[/TD]
[TD="class: xl69"]Lewis[/TD]
[TD="class: xl69"]Evan[/TD]
[TD="class: xl69"]Employee[/TD]
[TD="class: xl70"]EMPLOYEE, SPOUSE + 1 CHILD[/TD]
[/TR]
[TR]
[TD="class: xl68"]197[/TD]
[TD="class: xl69"]Lewis[/TD]
[TD="class: xl69"]Maria[/TD]
[TD="class: xl69"]spouse[/TD]
[TD="class: xl70"] [/TD]
[/TR]
[TR]
[TD="class: xl68"]197[/TD]
[TD="class: xl69"]Lewis[/TD]
[TD="class: xl69"]Victor[/TD]
[TD="class: xl69"]child[/TD]
[TD="class: xl70"] [/TD]
[/TR]
[TR]
[TD="class: xl68"]199[/TD]
[TD="class: xl69"]Clark[/TD]
[TD="class: xl69"]Kevin[/TD]
[TD="class: xl69"]Employee[/TD]
[TD="class: xl70"]EMPLOYEE[/TD]
[/TR]
</tbody>[/TABLE]
<style>table { }td { padding-top: 1px; padding-right: 1px; padding-left: 1px; color: black; font-size: 10pt; font-weight: 400; font-style: normal; text-decoration: none; font-family: Georgia, sans-serif; vertical-align: bottom; border: medium none; white-space: nowrap; }.xl63 { font-family: Calibri, sans-serif; }.xl64 { font-weight: 700; font-family: Calibri, sans-serif; }.xl65 { font-weight: 700; font-family: Calibri, sans-serif; text-align: center; border: 0.5pt solid windowtext; }.xl66 { color: black; font-weight: 700; font-family: Verdana; text-align: left; border: 0.5pt solid windowtext; }.xl67 { font-weight: 700; font-family: Calibri, sans-serif; border: 0.5pt solid windowtext; }.xl68 { color: black; font-family: Verdana; text-align: right; border: 0.5pt solid windowtext; }.xl69 { color: black; font-family: Verdana; text-align: left; border: 0.5pt solid windowtext; }.xl70 { font-family: Calibri, sans-serif; border: 0.5pt solid windowtext; }</style>

Is it possible to do this with a regular formula, or would I require a UDF please?

I am not sure how to tackle this please, so would be very grateful for your expert guidance.

Many thanks in advance

Wednesday
<style>table { }td { padding-top: 1px; padding-right: 1px; padding-left: 1px; color: black; font-size: 10pt; font-weight: 400; font-style: normal; text-decoration: none; font-family: Georgia, sans-serif; vertical-align: bottom; border: medium none; white-space: nowrap; }.xl63 { font-family: Calibri, sans-serif; }.xl64 { color: black; font-family: Verdana; text-align: right; border: 0.5pt solid rgb(170, 170, 170); }.xl65 { color: black; font-family: Verdana; text-align: left; border: 0.5pt solid rgb(170, 170, 170); }.xl66 { font-weight: 700; font-family: Calibri, sans-serif; }.xl67 { font-weight: 700; font-family: Calibri, sans-serif; text-align: center; }.xl68 { color: black; font-weight: 700; font-family: Verdana; text-align: left; border: 0.5pt solid rgb(170, 170, 170); }</style>
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
maybe something like this with PowerQuery?

[Table="width:, class:head"]
[tr=bgcolor:#FFFFFF][td=bgcolor:#5B9BD5]ID[/td][td=bgcolor:#5B9BD5]LAST NAME[/td][td=bgcolor:#5B9BD5]FIRST NAME[/td][td=bgcolor:#5B9BD5]Status[/td][td][/td][td=bgcolor:#70AD47]ID[/td][td=bgcolor:#70AD47]LAST NAME[/td][td=bgcolor:#70AD47]FIRST NAME[/td][td=bgcolor:#70AD47]Status[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]
84​
[/td][td=bgcolor:#DDEBF7]Doe[/td][td=bgcolor:#DDEBF7]Joe[/td][td=bgcolor:#DDEBF7]Employee[/td][td][/td][td=bgcolor:#E2EFDA]
84​
[/td][td=bgcolor:#E2EFDA]Doe[/td][td=bgcolor:#E2EFDA]Joe[/td][td=bgcolor:#E2EFDA]Employee[/td][/tr]

[tr=bgcolor:#FFFFFF][td]
88​
[/td][td]Smith[/td][td]Alan[/td][td]Employee[/td][td][/td][td]
88​
[/td][td]Smith[/td][td]Alan[/td][td]Employee[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]
192​
[/td][td=bgcolor:#DDEBF7]Jones[/td][td=bgcolor:#DDEBF7]Jack[/td][td=bgcolor:#DDEBF7]Employee[/td][td][/td][td=bgcolor:#E2EFDA]
192​
[/td][td=bgcolor:#E2EFDA]Jones[/td][td=bgcolor:#E2EFDA]Jack, Emma, John, Jane, Jessica[/td][td=bgcolor:#E2EFDA]Employee, spouse, child, child, child[/td][/tr]

[tr=bgcolor:#FFFFFF][td]
192​
[/td][td]Jones[/td][td]Emma[/td][td]spouse[/td][td][/td][td]
195​
[/td][td]Davies[/td][td]Mark[/td][td]Employee[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]
192​
[/td][td=bgcolor:#DDEBF7]Jones[/td][td=bgcolor:#DDEBF7]John[/td][td=bgcolor:#DDEBF7]child[/td][td][/td][td=bgcolor:#E2EFDA]
197​
[/td][td=bgcolor:#E2EFDA]Lewis[/td][td=bgcolor:#E2EFDA]Evan, Maria, Victor[/td][td=bgcolor:#E2EFDA]Employee, spouse, child[/td][/tr]

[tr=bgcolor:#FFFFFF][td]
192​
[/td][td]Jones[/td][td]Jane[/td][td]child[/td][td][/td][td]
199​
[/td][td]Clark[/td][td]Kevin[/td][td]Employee[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]
192​
[/td][td=bgcolor:#DDEBF7]Jones[/td][td=bgcolor:#DDEBF7]Jessica[/td][td=bgcolor:#DDEBF7]child[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td]
195​
[/td][td]Davies[/td][td]Mark[/td][td]Employee[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]
197​
[/td][td=bgcolor:#DDEBF7]Lewis[/td][td=bgcolor:#DDEBF7]Evan[/td][td=bgcolor:#DDEBF7]Employee[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td]
197​
[/td][td]Lewis[/td][td]Maria[/td][td]spouse[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]
197​
[/td][td=bgcolor:#DDEBF7]Lewis[/td][td=bgcolor:#DDEBF7]Victor[/td][td=bgcolor:#DDEBF7]child[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td]
199​
[/td][td]Clark[/td][td]Kevin[/td][td]Employee[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]
 
Upvote 0
Hi Sandy

Thank you. I have never heard of Power Query before. Does it work for Excel 2011 for Mac please?

Regards

Wednesday
 
Upvote 0
Hi Sandy

Thanks anyway. Is it not possible with a regular formula?

Regards

Wednesday
 
Upvote 0
I don't know :) Maybe someone else will give a solution with formula

Have a nice day
 
Upvote 0
Based on your data how about, a UDF
Code:
Function ListStatus(Cl As Range, Rng As Range) As String
   Dim i As Long
   If Not Cl.Offset(, 3) = "Employee" Then Exit Function
   ListStatus = Cl.Offset(, 3).Value
   i = Application.CountIf(Rng, Cl)
   Select Case i
      Case 2
         ListStatus = ListStatus & ", Spouse"
      Case 3
         ListStatus = ListStatus & ", Spouse + 1 Child"
      Case Is > 3
         ListStatus = ListStatus & ", Spouse + " & i - 2 & " Children"
   End Select
End Function
Used
=ListStatus(A2,A:A)
 
Upvote 0
Dear Fluff

You are a star!

Thank you so much. It works a treat.

A very grateful

Wednesday
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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