Extract Word that Begins with a " Quote - excel-formula

I have the following formula that Part 1) Looks at cell A7 and if begins with ABC or DEF places that in the cell, if it does not then it looks at the notes in cell B7 and extracts a claim number from my data if it begins with CCLVL, GCFAC, CLINK, CCQWC or CCQWA
the problem is that the word CLINK in my data begins with a " quote - how do I get the formula to find "CLINK and then drop the "? Is that possible?
Here is the formula
=IF(ISNUMBER(SEARCH("abc",A7)),A7,IF(ISNUMBER(SEARCH("DEF",A7)),A7,IFERROR(#FILTERXML("<t><s>"&SUBSTITUTE(B7," ","</s><s>")&"</s></t>","//s[starts-with(., 'CCLVL') or starts-with(., 'GCFAC') or starts-with(., 'CLINK') or starts-with(., 'CCQWC') or starts-with(., 'CCQWA')]"),"")))
If data contains "CLINK456789 I want the result to be CLINK456789

Use a helper column
Use a helper column. Assuming the helper column is C, then the formula in C7 is going to be:
=SUBSTITUTE(A7,"""","")
Then in your own formula in B7, replace all references to A7 with C7. There are plenty of related questions like this.

Related

Why some of the content cannot be extracted

I need to extract this from the cell
For example:
A1 : abode abcd=1000seconds long=50cm
I need only 1000. With this sequence and this formula I can extract 1000 from the cell.
The formula I use is MID(A1, SEARCH(“=“,A1) + LEN(“=“), SEARCH(“seconds”,A1)-SEARCH(“=“,A1)-LEN(“=“))+0
However when the sequence of cell become:
A1 : long=50cmabode abcd=1000seconds
The 1000 cannot be extracted.
Please help
Edit, since OP mentioned they are using Excel 2016, formula changed accordingly
• Formula used in cell D2
=SUBSTITUTE(FILTERXML("<m><b>"&SUBSTITUTE(SUBSTITUTE(B2,"="," ")," ","</b><b>")&"</b></m>","//b[contains(., 'seconds')]"),"seconds","")
Alternative Approach,
• Formula used in cell C2
=SUM(IFERROR(--TEXTAFTER(TEXTBEFORE(B2,"seconds"),"=",{1,2}),0))

How to extract numbers with separation in Excel

Does anyone knows any formula to extract the number with separation (dot, comma) from cell A1 to cell B1?
Example, I want to extract 2,590.00 from cell A1 which has the following value:
[sum: 2,590.00]
I got the formula below that works nice, however is just getting all numbers e.g. 259000
{=TEXTJOIN("",TRUE,IFERROR((MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)*1),""))}
I appreciate every support
Under O365 you can try the following in cell B1 which is a very concise approach:
=TEXTAFTER(TEXTBEFORE(A1,"]"), "sum: ")
Here is the output:
For excel-2019, similar idea but using SUBSTITUTE instead to remove the prefix ([sum: ) and the suffix (]):
=SUBSTITUTE(SUBSTITUTE(A1,"[sum: ",""),"]","")
You can use a formula like as below:
• Formula used in cell B1
=MAX(IFERROR(--MID(SUBSTITUTE(A1,"]",""),ROW($ZZ1:INDEX($ZZ:$ZZ,LEN(A1))),LEN(A1)),0))
• With OFFICE 365, you can try this in cell C1
=--INDEX(TEXTSPLIT(A1,{":","[","]"},,1),,2)
• Formula used in cell D1
=SUBSTITUTE(TEXTAFTER(A1," "),"]","")*1

Excel - breaking up a cell

I have part numbers with dashs and numbers for organization purpose, and I was wondering if there's a way I could de-concatenate the string into nearby cells with a formula or two and not go through Data > Text to Columns. Any idea?
Here's a demo of a formula-based approach. The formulas will work in Excel.
https://docs.google.com/spreadsheets/d/1LXtKOsxzo1J2-D1e4e_QUqxUug191GHJ5exWSWcoS0s/edit?usp=sharing
It works like this:
A1 contains the string you want to break up, say 12424-22778-3432626-442-52523262.
B2 contains this formula: =FIND("-",$A1,1). This will find us the first occurrence of - in A1.
B3 contains this formula: =FIND("-",$A1,B1+1). This will find us the next occurrence of - in A1 (it starts looking for - from the position following what we found in B2.
B4... can be copied over from B3. If you copy the cell rather than the formula, the formula will automatically change the reference to B1 to C1 and up. In the example, it's copied over all the way to E1.
F1 contains =mid($A1,1,B1-1). This gets us the string from the first char to the B1-1th char, i.e.: start to first occurrence of -, but without the -.
G1 contains =mid($A1,B1+1,C1-B1-1). You can copy this over up to the second to last cell. The gets us the string from the previous - (+1, i.e. without the -) to the next - (-1, i.e. without the -).
J1 is the last cell and contains =mid($A1,$E1+1,len($A1)). It works the same as the previous formula, but goes up to the end of the string in A1.

Using VLOOKUP for Multiple Parts of a Cell

I am trying to create a decoding macro. I have different combinations of letters in each cell on one sheet. For example, in cell B2 I would have something like "ABC." On a different sheet I have a table that matches letters to numbers, so I want the output in the new cell to be "123" in that case. I know how to use VLOOKUP on an entire cell, but cannot figure out how to use it on individual parts and then concatenate the results back together in the new cell.
This is what I've figured out so far. I think I need INDIRECT as part of it so I can reference the cell, but I cannot figure out how to look up the different portions of the cell. I do not want to create new columns to split the letter combinations up if possible.
=IFERROR(VLOOKUP("not sure??",'Conversion Table'!A4:B19,2,FALSE),"")
Thanks!
I'm assuming your cell B2 is limited to 3 chars only, and it's the same everywhere. In this case, you can do:
=CONCATENATE(VLOOKUP(MID(B2,1,1),'Conversion Table'!$A$4:$B$19,2,0),VLOOKUP(MID(B2,2,1),'Conversion Table'!$A$4:$B$19,2,0),VLOOKUP(MID(B2,3,1),'Conversion Table'!$A$4:$B$19,2,0))
If you have more chars, only add them using concatenate and select them one by one using MID.
Edit - locked the lookup table.
I think what you may be looking for is this:
A B C D
1 =""
2 ABC =IFERROR(VLOOKUP( =D1&C2
B2,
'Conversion Table'!$A$4:$B$19,
2,FALSE),"")
3 XYZ =IFERROR(VLOOKUP( =D2&C3
B3,
'Conversion Table'!$A$4:$B$19,
2,FALSE),"")
4 PQR =IFERROR(VLOOKUP( =D3&C4
B4,
'Conversion Table'!$A$4:$B$19,
2,FALSE),"")
5 DEF =IFERROR(VLOOKUP( =D4&C5
B5,
'Conversion Table'!$A$4:$B$19,
2,FALSE),"")
The "Final Answer" appears in cell D5

Getting the Nth instance of an element

I have a column filled with data that has a path. I'd like to get the last element in the path, the second last element, and the first element. For example, for the following data:
\Product\Release\Iteration
\Product\Folder1\Folder2\Anotherfolder\Release2\Iteration5
\Product
\Product\Somefolder\Release3\Iteration5
I'd like to get the following in cells
In cell B1: "Product", cell C1: "Release", cell D1: "Iteration"
In cell B2: "Product", cell C2: "Release2", cell D2: "Iteration5"
In cell B3: "Product", cell C3: blank, cell D3: blank
In cell B4: "Product", cell C4: "Release3", cell D4: "Iteration5"
Getting the first and the last component is easy. I'm mostly just struggling with getting the second to last component (column C in the example above).
In B1 and copied down:
=TRIM(MID(SUBSTITUTE(A1,"\",REPT(" ",99)),99,99))
In C1 and copied down:
=IF(LEN(A1)-LEN(SUBSTITUTE(A1,"\",""))=2,TRIM(RIGHT(SUBSTITUTE(A1,"\",REPT(" ",99)),99)),IF(LEN(A1)-LEN(SUBSTITUTE(A1,"\",""))>2,TRIM(LEFT(RIGHT(SUBSTITUTE(A1,"\",REPT(" ",99)),198),99)),""))
In D1 and copied down:
=IF(OR(LEN(A1)-LEN(SUBSTITUTE(A1,"\",""))={1,2}),"",TRIM(RIGHT(SUBSTITUTE(A1,"\",REPT(" ",99)),99)))
Assuming your data is in ColumnA use Text to Columns with \ as delimiter to split across columns B:G. Assuming a maximum of 8 elements, put =B1 in K1 and in L1:
=IF(AND(ISBLANK(D1),ISBLANK(C1)),"",IF(ISBLANK($D1),$C1,IF(ISBLANK(C1),"",INDIRECT("R"&ROW()&"C"&COLUMN()-COUNTBLANK($B1:$I1)-4,0))))
Copy L1 to M1 and K1:M1 down to suit.
Copy Paste Special Values over the top and delete columns A:I.
Made up two formulas to retrieve any part of the path you want:
Taking the first as starting from the left:
=IFERROR(MID(A3,FIND(CHAR(1),SUBSTITUTE(A3,"\",CHAR(1),C$2))+1,IFERROR(FIND("\",A3,FIND(CHAR(1),SUBSTITUTE(A3,"\",CHAR(1),C$2))+1)-FIND(CHAR(1),SUBSTITUTE(A3,"\",CHAR(1),C$2))-1,LEN(A3))),"")
Taking the first as starting from the right:
=IFERROR(MID(A3,FIND(CHAR(1),SUBSTITUTE(A3,"\",CHAR(1),LEN(A3)-LEN(SUBSTITUTE(A3,"\",""))+1-D$2))+1,IFERROR(FIND("\",A3,FIND(CHAR(1),SUBSTITUTE(A3,"\",CHAR(1),LEN(A3)-LEN(SUBSTITUTE(A3,"\",""))+1-D$2))+1)-FIND(CHAR(1),SUBSTITUTE(A3,"\",CHAR(1),LEN(A3)-LEN(SUBSTITUTE(A3,"\",""))+1-D$2))-1,LEN(A3))),"")
And here's a google spreadsheet where you can see how it's working.
Note: I had to make a few changes to the formulae to make it google-spreadsheet-compatible, namely:
Change CHAR(1) to something else, I used "/" as substitute
Add an IF() to check for SUBSTITUTE(,,,0) (the 0 parameter) since this gives an error in MS Excel but not on google spreadsheet.
If you just need to parse the data to cells, you could import a text file into Excel with '\' delimitor. Otherwise, you need to loop through with CHARINDEX() and SUBSTRING to find the position of each backslash and parse out the data in between.
You could also use SSIS and set up a text file transformation with '\' delimitor to Excel for automation. With TSQL, you need to loop as I suggested
This has an excellent example that uses the split command. You just need to change the | character to \ and use the loop to put the individual values in the places you want.
Break string based on a character in VBA 2010
This should work for you (assuming you don't use * in your file names which I don't think is allowed in windows anyways):
=RIGHT(A2,LEN(A2)-FIND("*",SUBSTITUTE(A2,"\","*",(LEN(A2)-LEN(SUBSTITUTE(A2,"\","")))-1),1))
That is for the second last element.
You can get any element you want by changing the bold number:
=RIGHT(A2,LEN(A2)-FIND("",SUBSTITUTE(A2,"\","",(LEN(A2)-LEN(SUBSTITUTE(A2,"\","")))-3),1))
EDIT/ADDITION
If you want to get rid of the values to the right of the nth element in the formulas above, you can do it like this:
=IFERROR(LEFT(RIGHT(A2,LEN(A2)-FIND("*",SUBSTITUTE(A2,"\","*",(LEN(A2)-LEN(SUBSTITUTE(A2,"\","")))-1),1)),FIND("\",RIGHT(A2,LEN(A2)-FIND("*",SUBSTITUTE(A2,"\","*",(LEN(A2)-LEN(SUBSTITUTE(A2,"\","")))-1),1)),1)-1),"error checking, lol")

Resources