Finding Numbers In Text String
May 11, 2010
In a data report i have a column which contains a mix of text and may contain an 8 digit number which could start in 0.
for example
in column A i could have "Hello how are you 01237232 I am fine"
I wish to extract the number into a seperate column, and would ordinarilly use a mid or left/ right function, however the text infront and behind the number will vary in length, which means i cannot do this.
The number will always be 8 digits, could start in 0 but will not always, and it may not be present in all the cells in this column.
How I an achieve this?
View 11 Replies
ADVERTISEMENT
Aug 11, 2009
I am trying to find numbers from a string. I have for example words "EUR Fwd 9x12" and "Eur Fwd 11x15" And i want to write a function that reads the first number from a string if there is only one number before "x" or two numbers if there are 2 numbers. So I have tried to build following function:
Function NumbersInString(Word As String) As Integer
Dim i As Integer
Dim FirstNumberInString As Integer, SecondNumberInString As Integer
For i = 1 To Len(Word)
If IsNumeric(Mid(Word, i, 1)) Then
FirstNumberInString = Mid(Word, i, 1)
If IsNumeric(Mid(Word, i + 1, 1)) = False Then
Exit Function
Else
SecondNumberInString = Mid(Word, i + 1, 1)
End If
End If
Next
NumbersInString = FirstNumberInString & SecondNumberInString
End Function
View 9 Replies
View Related
Jun 29, 2014
I need to create a macro to do the following:
Search the activecell for a text string (a), and then either paste in text string (b) at the end of the cell if (a) is found, or text string (c) if (a) is not found.
For example, if the activecell has "AA/" in it, I want the cell to become "AA/01" (pasting in "01" at the end), and if the cell has just "AA" in it, I want it to still become "AA/01" (pasting "/01" at the end). The macro will be linked to a commandbutton.
View 7 Replies
View Related
Oct 24, 2008
On my spreadsheet I have a column entitled: "Item Title", and the data within this column can look like the following;
View 3 Replies
View Related
Oct 28, 2007
I want to find a number within a text string, then count the letters in the same string, then add the number to the number of letters.
For example, if I have 9RR in a cell, I want to add 9 + 2 = 11.
The data will always be arranged with the number on the left side of the string.
So, if the number is a single digit, I know I can use left(A1) + len(A1) -1 to get my desired result. But, the trouble I am having is what if there is a double digit number like 10RR...I'm not quite sure how to create a formula (without using VBA) to give me a result of 12 for this cell.
View 9 Replies
View Related
Apr 10, 2008
I have a mass of text in a cell. I would ideally like to search the text to format in a different font colour so it can be easily seen where the specific text is.
My current way is to use SEARCH in conditional formatting but this changes the whole cell not the specific text I am interested in.
EG. - I interested in the text PETER in my cell so would like PETER to be in red font.
A peck of pickled peppers Peter Piper picked; If Peter Piper picked a peck of pickled peppers, Where's the peck of pickled peppers Peter Piper picked?
View 10 Replies
View Related
May 21, 2008
i need help with 2 formulas to return text within a longer string.
the first result i need is a style #. this will always start at the 5th character, but the length is variable. it will always end right before the last "/" or "" in the string (there may or may not be a / or within the style number)
the 2nd result i need is a description of the style. this will always be after the last "/" or "" in the string and end before a ".", but there may not always be a period in the string.
Text string: ABC123123BASIC TEE.black
Style # result: 123123
Description result: BASIC TEE
Text string: DEF/4567LEAH/FLORAL TANK DRESS
Style # result: 4567LEAH
Description result: FLORAL TANK DRESS
View 10 Replies
View Related
May 12, 2014
I have a report that in column BX has a large string of text (html information). Within this text there is a phrase called "| Hear = Education Website |" The phrase Education Website can be a variety of things though (Up to 9 choices). What is a formula I could use to just pull out the text after "Hear =" but before |""?
View 8 Replies
View Related
Jun 16, 2012
Title should read: Finding the nth Occurrence of a character within a text string
I have a very long text string that is delimited by about 50 "/" to segment certain values within the text string. I want to be able to extract the text between the 33rd and 34th occurrence of "/". How to do this?
View 5 Replies
View Related
Mar 12, 2008
Is there a function in VBA that is similar to either the FIND function or SEARCH function in Excel? The arguments for the FIND function in Excel are FIND(find_text, within_text, [position]).
I have a text string in VBA ("$A1:$D$13") that I want to be able to identify the first "$" and then later the ":". I'm getting tripped up on the 3rd line of code. Thanks a million.
Sub page_set_print_area()
ActiveSheet.PageSetup.PrintArea = "$A$1:$D$13"
x = ActiveSheet.PageSetup.PrintArea
Position$ = Search("$", x, 0)
End Sub
View 9 Replies
View Related
Oct 3, 2011
I'm trying to restructure a list of files at work into a format that makes some sort of sense and can be filtered into useful information.
Part of what I need to do, is match up all the drawing numbers that a certain project references. The numbers are formatted like "####A##" ex. 1234A01,1234A02,5678A01, etc. The cells that I need to extract drawing numbers from contain some description or other text (not just the drawing number) so I need to extract the drawing number from that cells value. (Ex. I need to get the drawing number 1234A01 from a cell whose value is "blah blah 1234A01 blah blah blah")
I was thinking I could just search the string for "####A##" but I'm not really sure how....I tried instr, but I think its searching for the literal value of "####A##" rather than treating the # characters as wildcards...
I tried:
Code:
if rngNames.Cells(intx, 2).Value Like ("*####A##*") then
set intStart = instr(1,rngnames.Cells(intx,2).value,"####A##")
'....
end if
but intStart remains 0, so this method is not working...
View 3 Replies
View Related
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?
View 8 Replies
View Related
Mar 12, 2014
I am trying to extract numbers after a specific text in a text string, for eg :abc SN 12345 xyzedf SN No. 456 mnoAs per above, i want to extract any numbers afters "SN". the numbers can be vary in digits i.e. it can be 3 digit numbers or 4 or 6. Also, at times there is some other text in between (like SN No.) numbers and search word (i.e. SN)Any formula to get result as "12345" and "456".
View 5 Replies
View Related
May 21, 2014
I am struggling with a problem which involves a column with both the text and nos in that. I want to calculate the following formula.
Total = the Sumproduct of the nos in the description*Length*Width*Height.
In the description column,
1) The nos will be varying i.e x*x or x*x*x or X*x*x*x*.
2) After the nos there will not be any data.
Example table:
Work Description
Length
Width
Height
Total
Parapet wall 2x4x8
12
2
4
6144
[Code] .......
Is there a way to achieve this, what is the formula for this ??
View 9 Replies
View Related
Sep 24, 2009
I have several lines with text strings containting three numbers in each line. I need a code to extract all three numbers from each text string. The numbers can be placed on the following columns in each row.
View 2 Replies
View Related
May 30, 2002
Is there a way to separate text from numbers, (other than text to columns)
My data is all different lengths, nothing consistent,plus I want to put the separated data in another column.
View 9 Replies
View Related
May 30, 2002
Is there a way to separate text from numbers, (other than text to columns)
My data is all different lengths, nothing consistent,plus I want to put the separated data in another column.
View 9 Replies
View Related
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?
View 3 Replies
View Related
Apr 22, 2014
I am in need of a formula that will separate a string of text. Specifically, I want to pull out the number values (including cents) from the rest of the text. This is how the text reads:
10.00 OVERDRAFT PROTECTION TRANSFER FEE
10.00
56.00 ELECTRONIC/ACH DEBIT
56.00
199.00 ELECTRONIC/ACH DEBIT
199.00
2,017.64 ELECTRONIC/ACH DEBIT
2,017.64
The data to the left is the data I am working with and the I want the results to read similar to the results on the right.
View 8 Replies
View Related
Dec 1, 2006
So for a program I am writing, the user inputs a text string of 200+ alphabetic letters. Only 20 of the 26 alphabet can be in this input (excluding BJOUXZ). What I need to have a macro or function do is check to make sure none of these 6 alphabet letters are present in the string, and also check to make sure no numbers are present either.
Also, I would love for the input text to be converted to Uppercase for all letter as it does this check.
View 9 Replies
View Related
Feb 19, 2008
I have got cell A1 containing this text string:
=IF(SUM('SL-001 - AT-001-001'!R[852]C:R[856]C)=0,SUMPRODUCT('SL-001 - AT-001-001'!R[826]C:R[830]C,
'SL-001 - AT-001-001'!R[840]C:R[844]C,'SL-001 - AT-001-001'!R[846]C:R[850]C),
SUMPRODUCT('SL-001 - AT-001-001'!R[826]C:R[830]C,'SL-001 - AT-001-001'!R[840]C:R[844]C,
'SL-001 - AT-001-001'!R[846]C:R[850]C,'SL-001 - AT-001-001'!R[852]C:R[856]C))
*'SL-001 - AT-001-001'!R992C*R3C9
and I would like a macro that will extract the numbers between each instance of the letters R and C , i.e. 852, 856, 826 etc etc. in cells A2, A3, A4 respectively.
View 9 Replies
View Related
Feb 8, 2013
I need to remove numbers from a string of text and put them into new cells in Excel Starter 2010. There are two different values which need moving. The first is in parentheses and the second follows the parentheses.
Here's a few examples of what I mean:
Original text
RED008 - Wickaman and Hoodlum bandwidth (0.06Gb @ 2.00) 0.12
MFR005EP - Various Artists bandwidth (0.19Gb @ 2.00) 0.38
RAZORS010 Future Cut bandwidth (0.01Gb @ 2.00) 0.01
would like to split into...
Cell 1
RED008 - Wickaman and Hoodlum bandwidth
MFR005EP - Various Artists bandwidth
RAZORS010 Future Cut bandwidth
Cell 2
(0.06Gb @ 2.00)
(0.19Gb @ 2.00)
(0.01Gb @ 2.00)
Cell 3
0.12
0.38
0.01
View 4 Replies
View Related
Dec 4, 2013
I need to remove only numbers from excel cell - I have tried using the "constant" function but did not work. I have thousands of cells with a consistent 4 digit number like this:
1000 the rest is text
How can I remove only numbers but leave all text in the cell and then if I can trim the cell so there are not any spaces at the beginning afte removing the numbers.
View 8 Replies
View Related
Oct 30, 2013
I am trying to identify the row(s) where a match occurs when there can be multiple occurrences of the match.
A
B
C
1
john brown
Brown
True
2
Cathy Smith
3
Brown excavating company
4
XYZ Corp
5
Brown Advisors Inc.
The first test I ran in cell C1 with the information above was to determine if "Brown" was located in the range of A1:A5 using formula:
=IF(ISNUMBER(MATCH("*"&B1&"*",A1:A5,0))=TRUE,"True","False")
In the case of the word "Brown" it occurs in the range of A1:A5 three times, so the result of the above formula would be "True"
Now what I would like to do is return the locations, in this case the row number(s), where the word brown is contained range of A1:A5 because in the case of the word Brown, it occurs three separate times in the range of A1:A5. I would like the resulting value of the formula in this case to be "1, 3, 5" indicating the word Brown occurs in rows 1, 3, and 5. The formula also needs to work in case there is only one match as well.
I tried using the below array formula:
={MATCH(FALSE,ISERROR(SEARCH(B1,'Working List of Vendors'!$A$1:$A$5)),0)}
But it would only return the first occurrence of the match which in this case would be row 1, or "1"
View 8 Replies
View Related
Dec 8, 2009
I'm looking for a formula that will count specific word in a cell.
Let say cell a1 has "WLLWWLLLLLLWWLLLWWWLLLWWLLWWLWLWLWLLLWWW"
I want to know how many WWLL are in this cell, which is 4.
I wrote this custom function to provide the answer. It is used like so: ..
View 13 Replies
View Related
Feb 25, 2014
I have been trying to write two formulas in one cell. I have been able to write them both separately but have been unable to join them both together. What I am trying to do if first search name them how many reoccurring numbers appear. I have provided an example below
a b c d
1 Tom 333
2 Sam 22
3 Sam 22
4 John 5
5 Sam 22
6 Sam 1
7 Tom 3
8 Tom 333
So the answer would be
Tom = 2
Sam = 2
John = 1
View 8 Replies
View Related
Mar 21, 2008
I work for a charity and I have to cancel the donations of people whose credit card donations have been declined in three consecutive months.
If in Column A I have a list of donor IDs whose credit cards were declined in Jan 2008, in Column B I have a list of donor IDs whose credit cards were declined in Feb 2008 and in Column C I have a list of donor IDs whose credit cards were declined in Mar 2008, is there a way of showing in a fourth column which donor IDs were common (repeated) in Columns A, B and C? I would have a title for each column in A1, B1 and C1, and also the column where the repeated donor IDs would be displayed.
View 9 Replies
View Related
Mar 13, 2013
I have this formula on my worksheet to test if column A="-" or "+"
Code:
=IF(OR(A:A="+",A:A="-"),NA(),"")
I would like to enhance this so that the test looks for the the + or - inside column A which might be a whole string rather than just one character and returns the same result (an NA# error if found).
I am doing this so I can then use SpecialCells to clear the cells containing the + or -
View 1 Replies
View Related
Aug 8, 2013
I have list of strings to be searched in column A2 to A150 (A1 has column title). The array that needs to be searched is in B2 to AG1000 (B1 to AG1 has column title). I want each string in column A to be searched in the full array. If match is found the corresponding column title (B1 or C1 and so.) and cell address needs to written to a new result columns in AY and AZ. it should work for duplicates as well i.e. the string can be in all the columns of array from B to AG. and all of them needs to be written to result column.
View 9 Replies
View Related
Jul 31, 2014
I'm trying to extract the number portion from the following string. I'm trying to use FIND to find the first digit between 1 and 2 so I used an "or" argument along with the code number, however it's not working here. What I really want to do is find any digit between 1 and 9 in the string, however I started with this formula for now. why this doesn't work and provide a better formula. I want to understand why this didn't work to understand the functions better. Text string is as follows "standard VAT rate: 20% (Jan 1984)". The formula I used in the following =MID(A253,FIND(OR(Char(49),CHAR(50)),A253),2) where A253 contains the string. Is it possible to use a logical argument within a find?
View 7 Replies
View Related