Extracting Data

baggarwal

Well-known Member
Joined
Jul 10, 2002
Messages
591
Hi All:

I have the following Table:
Book1
ABCD
2DataDesired
3NorthLosAngelesBranchNorthLosAngeles
4TorontoBranchToronto
5SanAntoniaBranchSanAntonio
6DesMoinesBranchDesMoines
Sheet1


Can someone please show me a formula that will extract all the data before branch. The data is in the first column. I am looking for a formula to place in the desired and drag it down.

Thanks so much
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Aladin this worked but can you please explain how this formula works or how you waved your magic wand?
 
Upvote 0
Hi Aladin:

Can the formula be modified to handle an instance like Los Angeles Sales Rep. Here is the table
Book1
ABCD
2DataDesired
3TorontoSalesReTorontoSales
4TorontoSalesTorontoSales
5TorontoSalesRepTorontoSales
6TorontoSalesRTorontoSales
7TorontoCSRTorontoCSR
8TorontoCSRETorontoCSR
9TorontoCSRSaTorontoCSR
10LosAngelesSalesRepLosAngelesSales
Sheet1


I noticed that that created an error.
 
Upvote 0
Hi Aladdin:

Thanks so much for your help. For some reason though the formula does not work for Los Angeles CSR when I drag it down it only gives me the Los Angeles part.

I tried my best to figure it out but gave up. What is the modification to the formula required to get this to work as well.

Thanks again
 
Upvote 0
Upvote 0
This is amazing thankyou. Can you explain how the formula works?

You're welcome.

The Isnumber(Search("Sales",A2)) part checks to see if "Sales" appears in the formula....Search() returns a position so the Isnumber() returns TRUE if a position is found.

Having found an instance of "Sales" in the string, then the TRUE condition of the IF() formula is evaluated. I.e. LEFT(A2,SEARCH("Sales",A2)+4). This takes the Left part of the string in A2 up to and including the word "Sales".

If the IF() condition returns FALSE, it is assumed then the string contains "CSR" instead of "SALES" and therefore returns the string up to and including the "CSR" string.
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,895
Members
449,097
Latest member
dbomb1414

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