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>
 
Hi,

If you're still interested in a Formula solution (last sample - employee #200 - has no Spouse & 1 Child):


Book1
ABCDE
1IDLAST NAMEFIRST NAMEStatusRESULTS REQUIRED
284DoeJoeEmployeeEMPLOYEE
388SmithAlanEmployeeEMPLOYEE
4192JonesJackEmployeeEMPLOYEE, SPOUSE + 3 CHILDREN
5192JonesEmmaspouse
6192JonesJohnchild
7192JonesJanechild
8192JonesJessicachild
9195DaviesMarkEmployeeEMPLOYEE
10197LewisEvanEmployeeEMPLOYEE, SPOUSE + 1 CHILD
11197LewisMariaspouse
12197LewisVictorchild
13199ClarkKevinEmployeeEMPLOYEE
14200BearPapaEmployeeEMPLOYEE + 1 CHILD
15200BearBabychild
Sheet393
Cell Formulas
RangeFormula
E2=IF(COUNTIF(A$2:A2,A2)=1,SUBSTITUTE("EMPLOYEE"&IF(COUNTIFS(A$2:A$15,A2,D$2:D$15,"spouse"),", SPOUSE","")&IF(COUNTIFS(A$2:A$15,A2,D$2:D$15,"child")," + "&COUNTIFS(A$2:A$15,A2,D$2:D$15,"child")&" CHILDREN",""),"1 CHILDREN","1 CHILD"),"")


Change/adjust cell references/range as needed, formula copied down.
 
Upvote 0

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
@ Fluff,

I would think to adjust your UDF for cases of Single Parents...
 
Upvote 0
Wow Jtakw

This is fantastic! Thank you so much.
You spotted that I forgot to account for cases where there are children and no spouses, and your formula even takes care of that scenario. I did adapt Fluff's UDF to account for that, but this formula is less volatile, so I will be using this solution instead.

How on earth you came up with it is beyond me. Huge thanks.

Regards
Wednesday
 
Upvote 0
You're welcome, glad it works for you.
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,267
Members
449,075
Latest member
staticfluids

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