Data Cleaning - String to Columns But Only Include Certain Values

Arktics

New Member
Joined
Jun 21, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi team,

Hoping somebody could help me out with this!

Image for context, I have extracted data from an example sports event as exported from the system being used. It returns a string of Events (column F) e.g.:

VBA Code:
TEAM2 Offence,TEAM1 Defence,TEAM2 Pass to CF,TEAM1 Pass to CF Conceded,TEAM2 Shot,TEAM1 GK Save,TEAM2 SoT,TEAM1 GK Save Left,TEAM2 Bounce Shot,TEAM2 Shot Inside 5m,TEAM2 Defence,TEAM1 Offence,Q1

I've used text-to-column to break down each of these into individual events which is okay - however this results in duplicate results as when a Team Offence event is recorded, it automatically assigns a Team Defence event as well. What I need is a way to draw out this string but to only include events that include the value in column E, i.e. TEAM1.

Appreciate if anyone has any advice on how to achieve this!

Thankyou.
 

Attachments

  • testdataset.PNG
    testdataset.PNG
    245.5 KB · Views: 18

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Welcome to the MrExcel board!

I wasn't entirely sure, but is this what you mean?

23 06 21.xlsm
EFGHIJKL
2TEAM1TEAM2 Offence,TEAM1 Defence,TEAM2 Pass to CF,TEAM1 Pass to CF Conceded,TEAM2 Shot,TEAM1 GK Save,TEAM2 SoT,TEAM1 GK Save Left,TEAM2 Bounce Shot,TEAM2 Shot Inside 5m,TEAM2 Defence,TEAM1 Offence,Q1TEAM1 DefenceTEAM1 Pass to CF ConcededTEAM1 GK SaveTEAM1 GK Save LeftTEAM1 Offence
Team Data
Cell Formulas
RangeFormula
G2:K2G2=LET(ts,TEXTSPLIT(F2,","),FILTER(ts,LEFT(ts,LEN(E2)+1)=E2&" ",""))
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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