ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Subtract text in one cell from another? (https://www.excelbanter.com/excel-worksheet-functions/33983-subtract-text-one-cell-another.html)

BigIan

Subtract text in one cell from another?
 
Hi,

I would like to subtract text in one cell from another, can anybody tell me
if it can be done?

For example:
Cell A1 has "John Smith"
Cell B1 has "John Smith violin teacher"

Can I subtract cell A1's contents from cell B1's contents to leave "violin
teacher"?

bj

in C1 enter
=substitute(B1,A1,"")

"BigIan" wrote:

Hi,

I would like to subtract text in one cell from another, can anybody tell me
if it can be done?

For example:
Cell A1 has "John Smith"
Cell B1 has "John Smith violin teacher"

Can I subtract cell A1's contents from cell B1's contents to leave "violin
teacher"?


Dave Peterson

I'd add...

=trim(substitute(B1,A1,""))

to get rid of the space between smith and violin.

Or maybe even...

=substitute(B1,A1&" ","")

bj wrote:

in C1 enter
=substitute(B1,A1,"")

"BigIan" wrote:

Hi,

I would like to subtract text in one cell from another, can anybody tell me
if it can be done?

For example:
Cell A1 has "John Smith"
Cell B1 has "John Smith violin teacher"

Can I subtract cell A1's contents from cell B1's contents to leave "violin
teacher"?


--

Dave Peterson

BigIan



"Dave Peterson" wrote:

I'd add...

=trim(substitute(B1,A1,""))

to get rid of the space between smith and violin.

Or maybe even...

=substitute(B1,A1&" ","")

bj wrote:

in C1 enter
=substitute(B1,A1,"")

"BigIan" wrote:

Hi,

I would like to subtract text in one cell from another, can anybody tell me
if it can be done?

For example:
Cell A1 has "John Smith"
Cell B1 has "John Smith violin teacher"

Can I subtract cell A1's contents from cell B1's contents to leave "violin
teacher"?


--

Dave Peterson



All times are GMT +1. The time now is 10:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com