Delete All??

Geek Girl 007

Board Regular
Joined
Mar 12, 2022
Messages
152
Office Version
  1. 2021
Platform
  1. Windows
From this table, can I delete, just 2 colours? i.e. all the Blue and Pink?

1722542030482.png


NameColour
JaneBlue, Pink Green, Purple, Red, Orange
PeterPink, Green, Red
CarolOrange, Pink
EvaBlue, Purple, Orange
JodieGreen, Purple, Red, Pink
DavidRed, Purple
EdwinGreen, Blue
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Upvote 0
I was going to suggest vba so that user could pass whatever the desired value is at any point. However, it would depend on consistent data and there is no comma between Pink Green in one cell.
 
Upvote 0
If you want the table being modified without the extra column, run this in VBA

VBA Code:
Sub jec()
Cells(1).CurrentRegion.Columns(2).Name = "ar"
[ar] = [let(s,substitute(substitute(ar&", ","Blue, ", ""),"Pink, ",""),left(s,len(s)-2))]
End Sub
 
Upvote 0
I was going to suggest vba so that user could pass whatever the desired value is at any point. However, it would depend on consistent data and there is no comma between Pink Green in one cell.
VAB is not very compatible with my work computer :(
 
Upvote 0
If you want the table being modified without the extra column, run this in VBA

VBA Code:
Sub jec()
Cells(1).CurrentRegion.Columns(2).Name = "ar"
[ar] = [let(s,substitute(substitute(ar&", ","Blue, ", ""),"Pink, ",""),left(s,len(s)-2))]
End Sub
VAB is not very compatible with my work computer :(
 
Upvote 0
Try:
Book3
ABC
1NameColour
2JaneBlue, Pink Green, Purple, Red, OrangePink Green, Purple, Red, Orange
3PeterPink, Green, RedGreen, Red
4CarolOrange, PinkOrange
5EvaBlue, Purple, OrangePurple, Orange
6JodieGreen, Purple, Red, PinkGreen, Purple, Red
7DavidRed, PurpleRed, Purple
8EdwinGreen, BlueGreen
Sheet1
Cell Formulas
RangeFormula
C2:C8C2=LET(s,SUBSTITUTE(SUBSTITUTE(B2&", ","Blue, ",""),"Pink, ",""),LEFT(s,LEN(s)-2))

Hi There,
Yes this worked perfectly, however wen I tried it on a larger scale I was unable to change and add to it?

The report i run is automatically generated (poorly) and I may need to add and change what I want to omit in the future.
This is the report:
Parameters
Code:C1
CodeSurnameFirst NameLocAgeEth. CodeNat. CodeRel. CodeMarital StatusMat. StatusDisab?LanguageActivity Description AM and PM
K52M1BRITNILSN/ANENGBICS
G38W9ROMAEORTHCN/ANCLASS-ESOL 1
H47W9ROMACHRSTMN/ANCLASS-ESOL 1, CE Service, CEFC Newsletter
K58W9POLEBUDDMN/ANBiohazard Cleaner
G37A1INDIMOSPN/ANCLASS-KITCHEN
C20W1BRITCOFESN/ANC Painter, CE Service, CEFC Newsletter
D50W9POLERCSN/AND Painter
B28O9BRITCHRSTNN/ANCE Service
H49A9VIETBUDDMN/ANCLASS-ESOL 1
D40B9BRITOTHNot EnteredN/AYD Painter
D49B9BRITCOFESN/ANCE Service, CEFC Newsletter, BICS
H33B2NIGERIABAPTMN/ANCE Service, CEFC Newsletter, Biohazard Cleaner
C32W1BRITNILSN/ANCLASS-Catering
H54W9HUNGRCMN/ANCLASS-ESOL 1
H49W9POLERCCN/ANCLASS-KITCHEN
D55W1BRITNILSN/AND Painter

1722584806414.png


In S6 I added: =LET(s,SUBSTITUTE(SUBSTITUTE(R6&", ","CE Service, ",""),"D Painter, ",""),"CEFC Newsletter, ",""),LEFT(s,LEN(s)-2))
and I got this:
1722584574112.png

I was trying to be clever, but I'm not sure what I did :(
Can you help?
 
Upvote 0
Upvote 0
Solution
Hi, here's another way you could try:

Book2
ABC
1NameColour
2JaneBlue, Pink Green, Purple, Red, OrangePink Green, Purple, Red, Orange
3PeterPink, Green, RedGreen, Red
4CarolOrange, PinkOrange
5EvaBlue, Purple, OrangePurple, Orange
6JodieGreen, Purple, Red, PinkGreen, Purple, Red
7DavidRed, PurpleRed, Purple
8EdwinGreen, BlueGreen
Sheet1
Cell Formulas
RangeFormula
C2:C8C2=LET(TS,TEXTSPLIT(B2,", "),TEXTJOIN(", ",1,FILTER(TS,NOT(ISNUMBER(MATCH(TS,{"Pink","Blue"},0))),"")))
PERFECT and adaptable. Thank you
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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