Extract Data from middle with variable length strings left and right?

startzc

New Member
Joined
Oct 1, 2014
Messages
4
I have been going through every command I can find and trying to tweak it to extract 2 separate sets of data into new columns. I was able to get half but the other would not work.

I need to extract just the BLDG# "90210" in one column, not always 5 characters but the "BLDG: " and the following semi-colon are always there.

In teh second column I need just the RM# whcih can vary from 1 to 6 characters in length and also always includes the "RM: " and following semi-colon.

[BLDG: 90210; RM: 108; ORGANIZATION: UNKNOWN; USER: $svc.FTEV.fsmpss; LAST UPDATE: 08/13/2014]

<colgroup><col></colgroup><tbody>
</tbody>

Alternatively if there is a way to just import that column into another spreadsheet and automatically delimit it I could easily make this work also.

Background info:
The spreadsheet this is in is being extracted fro Active Directory using a VBS script. This spreadsheet then gets imported into an Access database to track/manage assets, including location as entered every 60 days by moronic users that like to screw up our whole system.

Thanks
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
This works on your example.

=TRIM(MID(LEFT(A1,FIND(";",A1)-1),7,LEN(A1)))
 
Upvote 0
That worked for Bldg#. Thanks

I await something for the second set. I could get it to give me "RM: 128" but it would not take #s less than 3 digits or drop the "RM: " which I could work around if it would pull all the Rm#s at least.
 
Upvote 0
<code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; white-space: inherit; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">=RIGHT(LEN(A1)-x)Replace the x with the number of characters you want removed.Hope that helps!</code></pre>
 
Upvote 0
No, there are varying lengths of characters in front of and after the data I need, but thank you.
 
Upvote 0
Never-mind, but thank you for your help. Went a much easier way of just delimiting the column and then using =REPLACE to get rid of the lead characters. Now I have the data the way I need it.
 
Upvote 0
Try this formula to extract the number after „RM”:

=MID(A1,FIND("RM: ",A1)+4,FIND(",",A1,FIND("RM: ",A1))-FIND("RM: ",A1)-4)
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,715
Members
448,985
Latest member
chocbudda

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