Formula to delete data from a cell

Obewan

Board Regular
Joined
Aug 25, 2021
Messages
68
Office Version
  1. 365
Platform
  1. Windows
I want a formula I can drag down in column B to delete all data so the name just appears (i.e. the Rug 1, Rug 2.... etc. gets deleted)

Thanks

Book8
AB
1DataAnswer
2Rug 1BURN THE EDGEBURN THE EDGE
3Rug 2KICKING STONES
4Rug 3ZAMBORA LOLA
5Rug 4LIAR FOR HIRE
6Rug 5VACANT BOX
7Rug 6KINGSBRAE ANNA
8Rug 7ALL RUM
9Rug 8LEON KINGSBRAE
Sheet3
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
I want a formula I can drag down in column B to delete all data so the name just appears (i.e. the Rug 1, Rug 2.... etc. gets deleted)

Thanks

Book8
AB
1DataAnswer
2Rug 1BURN THE EDGEBURN THE EDGE
3Rug 2KICKING STONES
4Rug 3ZAMBORA LOLA
5Rug 4LIAR FOR HIRE
6Rug 5VACANT BOX
7Rug 6KINGSBRAE ANNA
8Rug 7ALL RUM
9Rug 8LEON KINGSBRAE
Sheet3
Further to this can I also have a formula in column C that identifies the number in columns A = so the answer in column would be 1
 
Upvote 0
Is it always exactly a one digit number, as shown in your examples?

If so, you could use this formula in cell B2:
Excel Formula:
=MID(A2,FIND(" ",A2,1)+2,LEN(A2))
and this formula in cell C2:
Excel Formula:
=MID(A2,FIND(" ",A2,1)+1,1)
 
Upvote 0
If the names do not contain any digits but the leading number could be more than one digit this may be an option.

23 09 07.xlsm
ABC
1DataNameNumber
2Rug 1BURN THE EDGEBURN THE EDGE1
3Rug 2KICKING STONESKICKING STONES2
4Rug 3ZAMBORA LOLAZAMBORA LOLA3
5Rug 4LIAR FOR HIRELIAR FOR HIRE4
6Rug 5VACANT BOXVACANT BOX5
7Rug 6KINGSBRAE ANNAKINGSBRAE ANNA6
8Rug 7ALL RUMALL RUM7
9Rug 28LEON KINGSBRAELEON KINGSBRAE28
Obewan
Cell Formulas
RangeFormula
B2:B9B2=TEXTAFTER(A2,SEQUENCE(10)-1,-1)
C2:C9C2=--TEXTAFTER(TEXTBEFORE(A2,B2)," ")
 
Upvote 1
Solution
If the names do not contain any digits but the leading number could be more than one digit this may be an option.

23 09 07.xlsm
ABC
1DataNameNumber
2Rug 1BURN THE EDGEBURN THE EDGE1
3Rug 2KICKING STONESKICKING STONES2
4Rug 3ZAMBORA LOLAZAMBORA LOLA3
5Rug 4LIAR FOR HIRELIAR FOR HIRE4
6Rug 5VACANT BOXVACANT BOX5
7Rug 6KINGSBRAE ANNAKINGSBRAE ANNA6
8Rug 7ALL RUMALL RUM7
9Rug 28LEON KINGSBRAELEON KINGSBRAE28
Obewan
Cell Formulas
RangeFormula
B2:B9B2=TEXTAFTER(A2,SEQUENCE(10)-1,-1)
C2:C9C2=--TEXTAFTER(TEXTBEFORE(A2,B2)," ")
Peter, I admit, I have not used the SEQUENCE function much, and from what I read, it is usually used in a different manner.
Can you explain the logic behind how you are using it to do what is needed here? I am trying to understand it.
Thanks
 
Upvote 0
Can you explain the logic behind how you are using it to do what is needed here?
SEQUENCE(10) produces the numbers 1,2,3,...,10
So SEQUENCE(10)-1 produces 0,1,2,...,9 (That is, a list of all digits. Could have instead used SEQUENCE(10,,0) to do the same thing)
The -1 final argument of TEXTAFTER says to return the text after the last occurrence of whatever is being used as the delimiter.
Using row 9 of my sample data TEXTAFTER the last occurrence of ..
2 would return "8LEON KINGSBRAE"
8 would return "LEON KINGSBRAE"
all other digits would return #N/A since they are not found in the text
Somehow TEXTAFTER knows to ignore all the #N/A values and to use the text after the 'farthest right' digit found.
 
Upvote 0
SEQUENCE(10) produces the numbers 1,2,3,...,10
So SEQUENCE(10)-1 produces 0,1,2,...,9 (That is, a list of all digits. Could have instead used SEQUENCE(10,,0) to do the same thing)
The -1 final argument of TEXTAFTER says to return the text after the last occurrence of whatever is being used as the delimiter.
Using row 9 of my sample data TEXTAFTER the last occurrence of ..
2 would return "8LEON KINGSBRAE"
8 would return "LEON KINGSBRAE"
all other digits would return #N/A since they are not found in the text
Somehow TEXTAFTER knows to ignore all the #N/A values and to use the text after the 'farthest right' digit found.
Very clever!
 
Upvote 0
If the names do not contain any digits but the leading number could be more than one digit this may be an option.

23 09 07.xlsm
ABC
1DataNameNumber
2Rug 1BURN THE EDGEBURN THE EDGE1
3Rug 2KICKING STONESKICKING STONES2
4Rug 3ZAMBORA LOLAZAMBORA LOLA3
5Rug 4LIAR FOR HIRELIAR FOR HIRE4
6Rug 5VACANT BOXVACANT BOX5
7Rug 6KINGSBRAE ANNAKINGSBRAE ANNA6
8Rug 7ALL RUMALL RUM7
9Rug 28LEON KINGSBRAELEON KINGSBRAE28
Obewan
Cell Formulas
RangeFormula
B2:B9B2=TEXTAFTER(A2,SEQUENCE(10)-1,-1)
C2:C9C2=--TEXTAFTER(TEXTBEFORE(A2,B2)," ")
Thankyou!! Works awesome!
 
Upvote 0
You're welcome. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,204
Members
453,022
Latest member
RobertV1609

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