# Extracting Text From A String With Variable Length

Jan 13, 2009

Hey I got a long String like this "[...] increase of x.xx% [...]".

I am trying to extract only the percentage number which can be of variable length, so maybe 900.99% or 9.99%.

I tried this formula:

=MID(G14,SEARCH("%",G14)-5,5)
but this one doesnt bring the right results as the percentage figure is often not exactly 5 characters long.

## Extract Number Of Variable Length From Text String

Jan 25, 2007

Imagine that I have this list of thousands of customers, who are listed in column B in the format "customer no+space+customer name".

Now I want to extract ONLY the customer no from the text string in column B and insert it as number value in column A on the same row.

Would have been easy with "Left" command, but as the customer numbers have variable length, I have a problem.

## Extracting Number Of Seconds From Variable Text String?

Oct 2, 2011

I have a column of cells, each with a with text string that has three possible formats where I want to extract the total number of seconds.

The three formats are:

nnn hrs nn min nn sec (example: 1 hrs 42 min 58 sec)
or
nn min nn sec (example: 55 min 1 sec)
or
nn sec (example: 10 sec)

The result I want is a numeric value of the total number of seconds in the text string.

For example a text string of: 1 hrs 42 min 58 sec

Should give the result: (1 x 3600) + (42 x 60) + 58 = 6,178

## How To Extract Variable Length String

Feb 9, 2014

i just wanna extract the date shown(last data until meet the first comma) in first column to another column.

column 1
abcde, 1234
abcd, 12345
abcdef, 123

column 2
1234
12345
123

## String Parsing With Variable Length Strings

Mar 28, 2006

I am trying to split up a cell into numbers and charachters and place them in
separate columns, but the lenght of the number part varies as does the
content of the character part.

For example, one cell could be 5#, 10Tins, 4 lb, 100Pcs, etc.
I would like to be able to pull out the #, Tins, lb, and Pcs in to their
own column.

I have found this formula:
=LEFT(A1,FIND("-",A1,1)-1)

but it assumes some level of consistency, the "-" in the cell.

## Extracting Date From Text Strings Of Different Length

May 9, 2008

Am trying to devise a formula that will allow me to extract a date (not stored in date format or recognizable by excel as such: "DEC1/09") and then manipulate it so that excel can recognize it and change it to a "1-Jan-01" form. Problem for me is that functions such as LEFT MID and RIGHT are very specific and sensitive obviously to any additional characters. some of my dates are preceded by "CAN BND 4.25/09"; "CANB BND 4.25/09"; "BC BND 4.25/09" and so on, you get the idea im sure that they are of differing lengths. The dates are equally strewn around as some (these are bond maturities) are 1st of the month while others may hold dates in the middle-end...15th, 30th, 31st etc.

is there a formula that will recognize the dates in the text strings regardless of string length and then a subsequent formula to manipulate the date to proper format?

i.e. "CAN BND 4.25/09 DEC1/09" and "CANB BND 4.25/07 JUN15/07"

Converted into: "01-Dec-09" and "15-Jun-07"

Not that the other parts of the string don't matter, already have macro that can recognize and rip bond coupons.

## Text Parsing With Variable Length?

Jun 10, 2014

Column M:
##/##/#### | Variable Length Text-####

Example:
01/06/2014 | Daniel Trimble-4048

I need to parse out the different parts of Column M.

In Column R -- "Close Date", I'm successfully using:
=LEFT(M2,FIND(" | ",M2)-1)

...to extract the close date of the donation.

In Column S, I want to list the donor name--which is all of the text after " | ", and before the "-".

I don't need anything after the hyphen, and fortunately in this data, no one's name has a hyphen in it.

The Close Date is working fine for the LEFT and FIND functions, but for the life of me, I can't seem to get MID to work for the variable-length text. The text will always start in the same position -- 14, as the date and delimiter are standardized. And the last 5 characters of the text are not variable in length, so they can be cut out completely.

How do I use MID to extract everything starting at position 14, and stopping 5 characters short of the end of the text?

## Extract Strings From Range Of Variable Length Text

Jan 18, 2008

I have the following issue. I have a list of strings. Each string contains certain characters that are exactly the same for all strings, some characters are different making the string longer (in some cases). What I need to do is extract some combination of characters from each string. The strings look like this:

AB & CDE & FG & I mmmm yyyy.HIJK
AB & CDE & FG & II mmmm yyyy.HIJK

The part "AB & CDE & FG & " (incl. spaces) is the same for each string. The next part contains a roman count from I to VII, causing the length of each string to vary. The "mmmm" part contains the current month spelled in full e.g. December. This part differs as well, for each string. The "yyyy" part contains the year in four digits, e.g. 2007. The part after the dot is the same for each string again.

What I need to do:
- is to extract the month and assign it to a new string
- extract the year and assign it to a new string
- extract the roman number, translate it to a normal number (II -> 2) and assign to a string (or integer).

## Shorten String Length If Exceeds 31 Characters (max Sheet Name Length)

Mar 27, 2014

I've set up a filing system which saves sheets/ workbooks based on the value of a cell - Range("B1") Everything works great apart from when ThisFile String length exceeds 31 characters which you may know is the max useable character length for a sheet name - I had no idea! 8-0

Is there a way i can check if string length exceeds 31 characters then, if it does, shorten it to 31 characters?

[Code] .....

## Give Cell A Value Based On Length Of Row (variable Row Length)

Jan 9, 2010

My worksheet contains data with the reaction times on a psychological test. Each respondent in the test has 280 rows in my excel sheet.

The 'perfect' length of the row, is from A to M. When an error is made in the test, the length of the row will increase. So the error length can be A to AA.

For me it is important to analyse the error. So I would like to give a perfect row length, the value 1, and an error row length a value 2.

So, in conclusion:

If:
Cell length = A1 - M1? --> Copy A1 B1 C1 (A B Cof that row) to Sheet3, and give D1 in sheet 3 the value 1

Cell length >= A1 - M1? --> Copy A1 B1 C1 (A B C of that row) to Sheet3, and give D1 in sheet 3 the value 2

## Extracting Phone Numbers From Text String Variation In Preceding Text

Mar 29, 2013

I'm pulling phone numbers out of text strings. There is text string ("Office:") indicating that the number following is an office number (the number that I need). MID and FIND take care of this. There are sometimes two instances of office numbers in single text string, so adding a second column using the third argument of FIND lets me start another search past the first instance of an office number. We have a bunch of office numbers with the qualifier "(Text)" after the original "Office" but before the phone number. How do I catch these ones?

## Extracting The Last Name Of A String Of Text

May 15, 2009

I have a column of names, I need to extract the last word

Simon Greaves
Martin John Mackay
Miss E Hoddle
Bob W Blanchflower
Sarah White
D Gascoigne
H G Gomes

Greaves
Mackay
Hoddle
Blanchflower
White
Gascoigne
Gomes

## Extracting Text From String Vba

May 11, 2007

I need to extract the text from a string that is always less the last three digits. For example if A1 is abcdefg I always have to take off "efg" and extract the rest of it to the left but the length of the string can vary. I can be dirty and record a macro where I find the length, subtract 3 and then using the LEFT worksheet function can get my result, but when I come to try to convert that to VBA. What is the VBA equivalent of LEFT worksheet function and how would I go about using LEN in conjuntion with subtracting 3 from it?

## Excel 2003 :: Extracting Text From Text String?

Sep 17, 2013

Date: 17/09/2013 KO: 19:45 Ref: B Malone Att: 7,574 extraction of text from the above text string which is say in A1. What l need is for Date to go in A2, KO in B2, Ref in C2, & Att in D2. I'm using Excel 2003

## Extracting Dates From Text String?

Aug 20, 2014

If I have a cell that contains a sentence and part of a date, for example "delivery due 01/09", I would like a formula that reads that cell, identifies the 01/09 bit and returns 01/09/2014.

The only trouble is that the date would always be variable, so it's more a case of "delivery due #/#"... if that's even possible.

## Extracting Data From A Text String

Sep 8, 2009

I have a few hundred rows of text in the fomat below: 1.23456 xxxxxxxxxxxxxxxxxxxx. The “x’s” represent text which is unique to each row. what the formula I need to extract the number (1.23456) at the start of the string? To complicate things the number may be reported to any number of decimal places, so the formula needs to be able to extract the first block of digits at the start of each row and report it as a number that can be used in calculations.

## Extracting A Date From A Text String

Sep 22, 2009

I have a column of data in the following format:

261D 31/12/2008

There is also a single space after the end of the date.

Can someone please show me a formula to extract the date from each cell in the column? This is slightly complicated by the fact that the number of days (“D”) could consist of 1, 2, 3 or 4 characters, and the date could also be of variable length (e.g. 1/1/2008 vs 31/05/2008)

## Extracting Word From Text String

Sep 11, 2013

I have random text strings which I need to extract the last part from in Excel.

The text string will be made up of code, but the word I need is always to the right of a prefix />

So for instance in A1 I have 76ruihfo:;.>6">/apple

I would want to extract "apple" from the string above into B1.

## Extracting Integers From A Text String

Sep 28, 2005

is it possilble to extract integers from a text string within a cell?

Eg.
Cell A1 - "ABC 123"
I want to extract the "123" from cell A1.

I have many text strings from which I need to extract the integers from.
The trouble is that each text string does not follow a consistent order, so I
cannot use text functions such as LEFT, MID or RIGHT to extract what i need.

## Extracting Values From An Text String (URL)

Oct 14, 2008

I was given a worksheet that contains a column (A) containing about 5,000 URLs (A1 to ~A5000). Each URL string includes three parameters that I want to capture the values.

For example =

[url]

The prameters are known but the values are random up to 256 characters.

I am trying to pull each of the values into a column for sortability and have been mildly successful using MID and FIND but no joy.

## Extracting Text Before And After Numeric String

Jul 31, 2009

I'm trying to extract alphanumeric data before and after a numeric string. The numeric string is in the middle of a URL, which is a varying distance from the start and end.

Here's a sample of my data:

URL Page ID Headline Section quiz.impression-http://www.stuff.co.nz/2677193 2677193

http://www.stuff.co.nz/travel/267779...flying-JetStar 2677794 Why-I-hated-flying-JetStar travel http://www.stuff.co.nz/technology/di...eo-a-smash-hit 1675213 Wedding-dance-video-a-smash-hit technology/digital-living http://www.stuff.co.nz/national/crim...ce-in-Auckland 2678248 Man-shot-by-police-in-Auckland national/crime http://www.stuff.co.nz/sport/rugby/s...it-for-Blackie 3674350 NZRU-set-to-bend-it-for-Blackie sport/rugby/super-14

I start with just column A and generate the other three from that.

I'm using some excellent code from a Mr Excel guru (thanks again Peter) to extract the 8-digit numeric string in column B, I just need C (after) and D (before).

That macro is:
Dim Bits
Dim c As Range
Dim i As Long

For Each c In Range("A4", Range("A" & Rows.Count).End(xlUp))....................

## Extracting Both Numbers And Text From A String

Jun 21, 2007

I have a woorkbook where I have a cell that has the following apperance:

12345678-ABCDEFG

The numbers can vary in length and as well as the text. What I am trying to do is to split this cell into to columns. Column 1 shows the account number, Column 2 should show the Text and the "-" sign should not be in any of the columns ie it should look something like this

Column1 Column2
12345678 ABCDEFG

I have found a useful function for the first part thanx to Mikerickson
URL:Extract Numerical Data

Function midNumber(inputStr As String) As Double
Dim i As Long
For i = 1 To Len(inputStr)
midNumber = CDbl(Val(Mid(inputStr, i)))
If midNumber <> 0 Then Exit Function
Next i
End Function

But how do i seperate the text and how do Crete a macro that would loop through some 2000 rows and create a column A and B from Column A?

## Extracting Data Between 2 Characters In A Text String

Dec 14, 2013

I have the data string below:

Career:25: 1-0-2 \$13,765

I would like to extract the 1 between the : and - and as a seperate extraction would like te 2 between the - and the \$ I have tried a few things but end up with the - as the length of the data changes

## Extracting Phone Number Out Of String Of Text?

Apr 30, 2013

Is there a way to extract a phone number out of a string of text. The phone number will always be expressed the same way (eight digits seperated by a space half way through) - 9999 9999. But the text before and after the number is random. Is there a macro to do this on a large scale? The method needs to be applied to hundreds of these strings, each on a new line.

An example of the string of text with the phone number underlined:

Alesdro 0 63PnantCey4281 5919 Aledio daSisaon' Brglry

## Extracting Number From Inconsistent Text String

Jul 4, 2014

I have an excel stock price template, where I need the current price to calculate the mid point if the chart.

This is the text I get from the webquery

Underlying stock: SBIN 2699.00 as on Jul 04, 2014 15:30:36 IST

I need a formula to extract the stock price '2699.00' only from this text.

The problems are sometimes its may change to underlying "stock" to "index", SBIN to RELIANCE or TATASTEEL, and the price some times two digit say 16, some times 6 letters say 150.05, or 8 digits say 15160.00

Formula, the text in B1 and need the price at A100.

## Extracting Text String Values From A Cell?

Jul 8, 2014

I am trying to transfer data from some appointment based software into a spreadsheet .
the data comes out as one row For example ,the following is the contents of cell A1: 06/06/2014 09:00 AM - 09:30 AM Patient: John Smith

What I would like to do is extract one column with the date ,one column with the patient forename and one with the patient surname.

I have tried various combinations of =RIGHT(A1,LEN(A1)-FIND(".",A1)) etc etc but cannot extract the data I need

## Searching For And Extracting Dollar Amount From Text String

May 8, 2014

I have about 2000 rows of text. Each row is a short write up about prospective new business. There is a reference to a projected dollar amount Within 'MOST' of the write-ups. In order to generate a report about the potential dollars being projected, I need to find an easy way to extract the dollar amount from the text.

In most cases, the projected dollar amounts are preceded by "FY2014" then a "\$". However, there are a handful of cases where there is no FY2014, but some variation of the year indicator. Most of the dollar amount entries are written is short text - FY2014 - \$5k, 2014 \$15k. While some others are written out - FY2014 - \$ - \$20,000. In still other cases, within the writeup reference is made to the amount of product projected to be shipped by using the dollar symbols. For example - Estimated ship totals \$\$ for FY2014 = \$5k. I've tried writing some formulas, but as in the last example - the first dollar signs are recognized rather than the dollar sign immediately before the value.

Sample data -
Estimated ship totals \$\$ for FY2014 = \$5K New Customer Prospect 4/9/2012 Customer has still not decided if he

2014 \$15K Funco 4/7/14 working on the program for the demo ...

Over 130 samples tested with about 90% accuracy. FY2014 Ship \$\$ = \$20,000 at least. Setter Line has 7 plants ...

## Extracting Specific Information From Text String To Conform To Format To Upload Into QB

Mar 21, 2014

I have a string of information in an Excel download from PayPal that I need to upload into QB; but, the information needs to be in a different format. The string from the download is:

Property Address - 1116 South PaxonBorrower " Testa and Son Contractors,LLCLoan # - 1402088Acct Executive " Brandon Tully

But, I need it to be:

1402040;TPAPR;141 North Clinton Street, East Orange, NJ 07017;Leslie P Carter

Is there a formula that I can use to extract specific information from the original string into columns so I can then concatenate the columns into the information I need to upload? Or is there a better way to do this? The Property Address and Borrower Name are not static sizes so I can't use a formula that counts spaces.

## Extracting Text From Text String

Mar 17, 2008

I have a meeting name in column A that also includes a meeting #. The meeting number is always enclosed in parentheses and is at the end of the meeting name. There could also be information enclosed in parenthesis in name. I want to extract just the meeting # from the name. Also, the length of the meeting number could change. Here is an example of a 3 meeting names:

Example 1: March Madness (FY2008) Boston (8765) I would want just 8765 to be extracted
Example 2: Year End Planning Audit (11567) I would want just 11567 to be extracted

How can I extract just that the meeting number from these meeting names.

## Find Variable Size Number Within Text String

Sep 20, 2007

I have a spreadsheet with a couple of hundred rows on each tab that looks like this: A1: #1 PENROSE TIJUANA MAMA PCH 2620039190 665794 12.00 CT 1 Front 1 1 1. The only constant is the 10 digit number followed by the 6 digit number in the middle and I want to use it to parse the text string. I want the output to be everything prior to the 10 digit number in A1, the 10 digit number in B1, the 6 digit number in c1 and everything else in D1 and so on through the rows.