ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Extracting Data From The Right of a Cell (https://www.excelbanter.com/excel-worksheet-functions/270749-extracting-data-right-cell.html)

Brian Ashcraft

Extracting Data From The Right of a Cell
 
Hello All,

Thanks in advance for you help!!

I am trying to extract data from a single cell in Excel.

Example Data:

MX04-08-1-EA
MX04-1000-100-EA
MX04-10-10000-50-EA

The data I want to extract is the data "to the left" of the "second
dash from the right".

Example Data, With Results:

MX04-08-1-EA MX04-08
MX04-1000-100-EA MX04-1000
MX04-10-10000-50-EA MX04-10-1000
MX-04-999-G7-1-EA MX-04-999-G7

My starting data can have two or more dashes in it, but will always
have a minimum of two.

For reasons which I will not go in to, I am unable to write vbScript
functions in this spreadsheet. I need to use the MID, LEN, FIND, etc
to accomplish this.

ANY help is much apprecaited....

Rick Rothstein

Extracting Data From The Right of a Cell
 
The data I want to extract is the data "to the left" of
the "second dash from the right".


Give this formula a try...

=LEFT(A1,FIND("?",SUBSTITUTE(A1,"-","?",LEN(A1)-LEN(SUBSTITUTE(A1,"-",""))-1))-1)

Rick Rothstein (MVP - Excel)



All times are GMT +1. The time now is 02:56 AM.

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