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:-

IDLAST NAMEFIRST NAMEStatusRESULTS REQUIRED
84DoeJoeEmployeeEMPLOYEE
88SmithAlanEmployeeEMPLOYEE
192JonesJackEmployeeEMPLOYEE, SPOUSE + 3 CHILDREN
192JonesEmmaspouse
192JonesJohnchild
192JonesJanechild
192JonesJessicachild
195DaviesMarkEmployeeEMPLOYEE
197LewisEvanEmployeeEMPLOYEE, SPOUSE + 1 CHILD
197LewisMariaspouse
197LewisVictorchild
199ClarkKevinEmployeeEMPLOYEE

<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>
</tbody>
<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

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
maybe something like this with PowerQuery?

IDLAST NAMEFIRST NAMEStatusIDLAST NAMEFIRST NAMEStatus
84​
DoeJoeEmployee
84​
DoeJoeEmployee
88​
SmithAlanEmployee
88​
SmithAlanEmployee
192​
JonesJackEmployee
192​
JonesJack, Emma, John, Jane, JessicaEmployee, spouse, child, child, child
192​
JonesEmmaspouse
195​
DaviesMarkEmployee
192​
JonesJohnchild
197​
LewisEvan, Maria, VictorEmployee, spouse, child
192​
JonesJanechild
199​
ClarkKevinEmployee
192​
JonesJessicachild
195​
DaviesMarkEmployee
197​
LewisEvanEmployee
197​
LewisMariaspouse
197​
LewisVictorchild
199​
ClarkKevinEmployee
 
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,215,063
Messages
6,122,935
Members
449,094
Latest member
teemeren

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