ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Need a Function to Remove Text (https://www.excelbanter.com/excel-worksheet-functions/124792-need-function-remove-text.html)

pemmert

Need a Function to Remove Text
 
Is there a function (or other Excel ability) to remove, in a single cell,
text after a certain character such as "-" e.g. to return "US" for
"US-AF-MIL" or "dot" for "dot-com"?

Teethless mama

Need a Function to Remove Text
 
=LEFT(A1,FIND("-",A1)-1)

"pemmert" wrote:

Is there a function (or other Excel ability) to remove, in a single cell,
text after a certain character such as "-" e.g. to return "US" for
"US-AF-MIL" or "dot" for "dot-com"?


Martin Fishlock

Need a Function to Remove Text
 
Hi

Try

=LEFT(A1,FIND("-",A1)-1)
--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"pemmert" wrote:

Is there a function (or other Excel ability) to remove, in a single cell,
text after a certain character such as "-" e.g. to return "US" for
"US-AF-MIL" or "dot" for "dot-com"?


bony_tony

Need a Function to Remove Text
 
If you want the pull out the first set of characters up to the '-',
then use =MID(A1,1,SEARCH("-",A1,1)-1)

Tony

On Jan 5, 9:41 am, pemmert wrote:
Is there a function (or other Excel ability) to remove, in a single cell,
text after a certain character such as "-" e.g. to return "US" for
"US-AF-MIL" or "dot" for "dot-com"?



pemmert

Need a Function to Remove Text
 
Thanks (everyone) for the quick response, it worked perfectly.

"Teethless mama" wrote:

=LEFT(A1,FIND("-",A1)-1)

"pemmert" wrote:

Is there a function (or other Excel ability) to remove, in a single cell,
text after a certain character such as "-" e.g. to return "US" for
"US-AF-MIL" or "dot" for "dot-com"?


pemmert

Need a Function to Remove Text
 
Sorry, spoke too soon. Follow up question. I get a #VALUE error if the
character to be found doesn't appear; is there a way to deal with that?

Thanks

"Teethless mama" wrote:

=LEFT(A1,FIND("-",A1)-1)

"pemmert" wrote:

Is there a function (or other Excel ability) to remove, in a single cell,
text after a certain character such as "-" e.g. to return "US" for
"US-AF-MIL" or "dot" for "dot-com"?


Peo Sjoblom

Need a Function to Remove Text
 
=IF(ISERROR(FIND("-",A1)),"Whatever you want to do if not
found",LEFT(A1,FIND("-",A1)-1))


Regards,

Peo Sjoblom

pemmert wrote:
Sorry, spoke too soon. Follow up question. I get a #VALUE error if the
character to be found doesn't appear; is there a way to deal with that?

Thanks

"Teethless mama" wrote:

=LEFT(A1,FIND("-",A1)-1)

"pemmert" wrote:

Is there a function (or other Excel ability) to remove, in a single cell,
text after a certain character such as "-" e.g. to return "US" for
"US-AF-MIL" or "dot" for "dot-com"?



All times are GMT +1. The time now is 05:27 AM.

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