Very simple formulas following but I am missing some understanding and it seems frustratingly simple.
Very simple text extraction:
MID(A1,Start Num, Num of Chars)
A simple formula text finding formula,
SEARCH(Find_text, within_text, start_num)
Combined these two formulas can find and extract text from a field between two text characters, for instance 'underscores', 'parentheses' 'commas'
So for example to extract
text to extract >>> Jimbo Jones
from a cell containing parentheses an easy formula would be;
Sample text A1 = Incident Report No.1234, user (Jimbo Jones) Status- pending
formula;
=MID(A1, SEARCH("(", A1)+1, SEARCH(")", A1) - SEARCH("(", A1) -1)
Extracted text = Jimbo Jones
The logic is simple
1.Identify cell containing text
2.Find the start number by nominating a first searchable character
3.Find the end number of the text being extracted by searching for the second searchable character
4.Subtracting the Start Number from the End number gives the number of characters to extract
Without using Search formula the code is;
MID=(A1,32,11) = Jimbo Jones
But if i want to extract text between commas or other identical characters (such as quotation marks, apostrophes, asterisk ) I need to use this formula following (which I found suggested)
=MID(A1, SEARCH(",", A1)+1, SEARCH(",", A1, SEARCH(",", A1) +1) - SEARCH(",",A1) -1)
Sample text A1 Incident Report No.1234 user, Jimbo Jones, Status- pending
Extracted text = Jimbo Jones
But I how do i nominate other boundaries, such as text between 3rd and 4th comma for example?
Sample text A1 Incident Report, No.1234, user, Jimbo Jones, Status- pending
The reason for my confusion is in the above formula excel finds the second iteration of the comma no matter where they are in the text yet the actual formula being used is identical to the formula finding the first comma, the count of characters seems to automatically assume somehow that I want the second comma not the first, how do i instruct the formula find subsequent iterations of commas, such as 3rd 4th or 9th?
And what am i not understanding in why the formula finds the 2nd comma?
Cheers!
To explain what you are confused about:
At first sight it looks that it uses same formula to find 1st and 2nd searched symbol. But at second look you might notice that there is and argument start_num which tells for a formula where to start looking from. If you give first symbol location +1 (SEARCH(",", A1) +1))as that argument, formula will start looking for first search symbol in this part: ' No.1234, user, Jimbo Jones, Status- pending' and will give answer 42. You got 1st occasion place with first formula and then second occasion with formula above. Just find length by substracting and thats it.
Possible solutions:
If you have Office 365, use TEXTAFTER() and TEXTBEFORE() as others have stated where you can pass instance number as an argument:
=TEXTAFTER(TEXTBEFORE(A1,",",4),",",3)
Result:
Then you can use TRIM() to get rid of unwanted spaces in begining and end.
If you use older version of Office you can use SUBSTITUTE() as workaround as it lets you to change nth occasion of specific symbol in text.
Choose a symbol that does not appear in your text and change 3th and 4th occasions of your searched symbol to it. Then look for them (in this example we will substitute , to #:
=MID(A1,SEARCH("#",SUBSTITUTE(A1,",","#",3))+1,SEARCH("#",SUBSTITUTE(A1,",","#",4))-(SEARCH("#",SUBSTITUTE(A1,",","#",3))+1))
Little explanation:
Formulas used in explanation column C:
C
=SUBSTITUTE(A1,",","#",3)
=SUBSTITUTE(A1,",","#",4)
=SEARCH("#",B1)
=SEARCH("#",B2)
=MID(A1,B3+1,B4-(B3+1))
Full formula:
=MID(A1,SEARCH("#",SUBSTITUTE(A1,",","#",3))+1,SEARCH("#",SUBSTITUTE(A1,",","#",4))-(SEARCH("#",SUBSTITUTE(A1,",","#",3))+1))
Trimmed:
=TRIM(MID(A1,SEARCH("#",SUBSTITUTE(A1,",","#",3))+1,SEARCH("#",SUBSTITUTE(A1,",","#",4))-(SEARCH("#",SUBSTITUTE(A1,",","#",3))+1)))
Thanks for the responses all, I grinded through using the two Formulas I asked about (MID and SEARCH) and I have a result.
It's not pretty nor elegant but it extracts the data as per requirement. I will benefit from the tips left here in response to my question as simpler options are available.
Requirement: Extract text between 3rd and 4th Commas using MID and SEARCH
Sample text A15
Incident Report (ammended), No.12545424234, user, Jimbo Jones, Status-
pending
MID(A15,(SEARCH(",",A15,(1+(SEARCH(",",A15,SEARCH(",",A15)+1)))))+2,(SEARCH(",",A15,(SEARCH(",",A15,SEARCH(",",A15)+1)+(SEARCH(",",A15)))-(SEARCH(",",A15,SEARCH(",",A15)+1)-(SEARCH(",",A15)))+1)-(SEARCH(",",A15,(1+(SEARCH(",",A15,SEARCH(",",A15)+1))))))-2)
Test Extracted
Jimbo Jones
Obviously this solution works on other text, but it's also obviously not easy to quickly amend for other text locations.
Anyway, cheers again for the pointers...
I am new to excel please help me.
So the situation is we have two contact no column
contact no contact no 1
9864573828 0145883
9834765849 1923832
018294 9876547834
i want to merge two column into 1 having contact no of 10 digit.
contact no
9864573828
9834765849
9876547834
I'm using Excel 2013
In Excel 2013 this formula can be used to list the 10 digit numbers from the first and second range without gaps:
=IFERROR(IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW(A:A)/(LEN(A:A)=10)/(ISNUMBER(--A:A)),ROW(1:1))),INDEX(B:B,AGGREGATE(15,6,ROW(B:B)/(LEN(B:B)=10)/(ISNUMBER(--B:B)),ROW(1:1)-SUMPRODUCT((LEN(A:A)=10)*(ISNUMBER(--A:A)))))),"")
It uses a lot of resources to calculate, so whole column references is highly discouraged. So use actual ranges instead like:
=IFERROR(
IFERROR(
INDEX(A:A,
AGGREGATE(15,6,
ROW($A$2:$A$5)
/(LEN($A$2:$A$5)=10)
/(ISNUMBER(--$A$2:$A$5)),
ROW(1:1))),
INDEX(B:B,
AGGREGATE(15,6,
ROW($B$2:$B$5)
/(LEN($B$2:$B$5)=10)
/(ISNUMBER(--$B$2:$B$5)),
ROW(1:1)
-SUMPRODUCT(
(LEN($A$2:$A$5)=10)
*(ISNUMBER(--$A$2:$A$5)))))),
"")
Note: I think (unable to verify myself) the formula needs entered with ctrl+shift+enter to make it an array formula.
What this formula does is get the first row of the first range where the string length is 10 and the string converted to a number does not produce an error (what would happen in case of text characters in the string).
When you drag down the formula it shows the second found, third, etc... until no values are found in the first range anymore.
In that case the IFERROR makes it look for the same logic in the second range.
As we want it to show the first found value first, we can't reset the ROW(1:1) * - that is used as a counter for the first smallest, second smallest, etc.. - * therefore we use the same counter and use SUMPRODUCT to subtract the total number of strings meeting the conditions in the first range. That way the counter will start at 1 for the second range and starts counting from there.
If no more values are found in the second range it will show a blank value.
So you can drag down the formula up to the first blank result to show each result.
It's probably still slow with actual range references. I highly advise to upgrade to Office 365.
Try the following formula-
=LET(x,TOCOL(A2:B13,1),FILTER(x,LEN(x)=10))
Since your excel version doesn't support TOCOL() and some other formulas you can use this simple solution:
=IF(LEN(A2)=10,A2,IF(LEN(B2)=10,B2,""))
Put it in C2 and drag id down for a result:
Since you didn't specify what to do if both columns has 10 digit number or both doesn't, in those cases it will return first 10 digit number or empty string.
With Excel, I need to find and remove some text from all cells in a column. Using the example below I need get all instances of DEV* and BA* into another column.
Example data in a column:
Data
Dan Smith DEV001
Bob Jones BA005
Bob Jones2 BA 005
Needed Result
DEV001
BA005
BA 005
This example works partially but not with multiple possible matches.
=TRIM(RIGHT(A2, LEN(A2) - SEARCH("DEV", A2)))
How can this be done with multiple possible matches?
Try using this
• Formula used in cell B1
=REPLACE(A1,1,MAX(IFERROR(FIND({"DEV","BA"},A1),""))-1,"")
Here is something to consider for those using ms365 with access to TEXTBEFORE():
Formula in B1:
=SUBSTITUTE(A1,TEXTBEFORE(A1,{"DEV","BA"}),"",1)
TEXTBEFORE() - will look (case sensitive) for either 'DEV' or 'BA' and will return the substring before the 1st occurence of any of these two;
SUBSTITUTE() - will replace (also case sensitive) this returned substring with nothing. And to make sure we won't substitute unwanted parts after the lookup value we only replace the 1st occurence.
I'm trying to use a wildcard and the SumIf function or a SumProduct Function. In one column I have different Transaction Descriptions. I want the function to give me all the totals for adjacent cells to cells containing a key word. I've tried the following formulas:
=SUMPRODUCT((ISNUMBER(SEARCH("Company",Sheet5!F2:F72)))*Sheet5!G3:G71)
=SUMIF(Sheet3!F:F,"*Company",Sheet3!G:G)
Neither will return a value.
My company descriptions vary, which is why I'm trying to use the wildcard. For example, sometimes the description in F is Company LLC - January, and sometimes its Company LLC - Parent Distribution, etc...I just need it to find all transactions with Company in the cell.
Thanks!
Here is a short example that you can adapt. It processes data in A1 through B5:
=SUMPRODUCT(--ISNUMBER(SEARCH("Company",A1:A5))*(B1:B5))
New to advanced excel concepts, I have a list of numbers such as:
101 02/22/2016
100 02/21/2016
and then another list like so:
101 01/01/2016 Apple
101 02/20/2016 Banana
100 02/21/2016 Apple
100 02/23/2016 Banana
I'm trying to get it where I use a vlookup with the number on the more basic table, check for a match on the advanced table then find the date on the advanced table that is closest to the date on the basic table, then return the value to the right (Banana, Apple).
I've got the vlookup part down, but placing an if statement just returns N/A and breaks every time.
I've also tried using this guide: http://eimagine.com/say-goodbye-to-vlookup-and-hello-to-index-match/
You can use this array formula:
=INDEX($C$1:$C$4,MATCH(MIN(IF($A$1:$A$4=E1,ABS($B$1:$B$4-F1))),IF($A$1:$A$4=E1,ABS($B$1:$B$4-F1)),0))
Being an array formula it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode. If done correctly then Excel will put {} around the formula.