Why some of the content cannot be extracted - excel

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))

Related

How to do an if statement

This question is linked to Formula to remove every middle name in a cell in Excel.
I basically want to make an if else statement in excel. So the IFchecks if the cell is equal to "Gian" OR"Pier", if the condition is confirmed the formula proceeds to use this other formula
=IFERROR(LEFT(A2,FIND(" ",A2)-1),A2)
Sorry guys idk how to do it in an excel way. I can show you in for example in a Java or C way.
if(A2=="Pier" || A2=="Gian")
=IFERROR(LEFT(A2,FIND(" ",A2)-1),A2) \\the excel formula that deletes every second/third name if the cell
if formula in excel that checks a condition and if its verified it proceeds to use another excel formula
You could try the following as per your Excel Versions
• Formula used in cell B2
=IF(OR(TEXTBEFORE(A2&" "," ")={"Pier","Gian"}),A2,TEXTBEFORE(A2&" "," "))
Or, in cell C2
=IF(OR(LEFT(A2&" ",FIND(" ",A2&" ")-1)={"Pier","Gian"}),A2,LEFT(A2&" ",FIND(" ",A2&" ")-1))
Just adding the use of LET() which makes it simpler,
• Formula used in cell B2
=LET(x,TEXTBEFORE(A2&" "," "),IF(OR(x={"Pier","Gian"}),A2,x))
Or, Formula used in cell C2
=LET(x,LEFT(A2&" ",FIND(" ",A2&" ")-1),IF(OR(x={"Pier","Gian"}),A2,x))
Using MAP() to Spill as one dynamic array formula but the logic remains same.
• Formula used in cell D2
=MAP(A2:A6,LAMBDA(m,
LET(x,TEXTBEFORE(m&" "," "),
IF(OR(x={"Pier","Gian"}),m,x))))
you have to use the AND(...) and OR(..) for chaining logical conditions.
Here's an example

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

How do I give cell values as parameters to ROW() formula in MS Excel?

Giving static numerical values to the ROW() formula like ROW($1:$2)) works perfectly (obviously), but I have both the values it requires in cells... Here what I am trying to build : ROW($C3:$E4)). This works, but gives me the value 3 (C3 cells's row).
What should I do in order to get the value inside C3 cell to pass it to ROW()?
For Excel 365:
If we enter:
=ROW(7:13)
in D1, we get:
Now if G1 contains 7 and G2 contains 13, then:
=ROW(INDIRECT(G1 & ":" & G2))
will give us the same result:
Don't use a volatile INDIRECT set-up when there exists a non-volatile alternative:
=ROW(INDEX(A:A,G1):INDEX(A:A,G2))
which is volatile only at workbook open.

Get several tags from excel cell

In a single cell I have the text of the form:
text #tag1 another text, text #anothertag, etc.
I need to pull out all the tags in the next cell. The tag may have a different number of characters. We assume that any tag ends with a space at the end, i.e.
#tag1, then the text
can be pulled out with a comma. If you can also trim the characters - would be great.
I can find one, but not all:
= MID (A2; SEARCH ("#"; A2) + 1; SEARCH (""; A2; SEARCH ("#"; A2) +1) - SEARCH ("" ; A2) - 1)
Any ideas ? No macros or external solutions, pure excel needed.
Requires Excel for Office 365, Excel for Office 365 for Mac, Excel 2019
Following array formula will return the required result assuming your source string is in cell A2.
=TEXTJOIN(", ",TRUE,IF(LEFT(TRIM(MID(SUBSTITUTE(" "&A2," ",REPT(" ",99)),ROW($A$1:$A$99)*99,99)))="#",TRIM(MID(SUBSTITUTE(" "&A2," ",REPT(" ",99)),ROW($A$1:$A$99)*99,99)),""))
Array formula shall be committed by CTRL+SHIFT+ENTER.
Note: Argument separator in my formula is "," whereas OP is using ";".
Edit:
For Excel 2016 and older versions
Following longer route can be implemented which will first extract results to individual cells.In cell C2 following formula shall be inserted.
=TRIM(MID(SUBSTITUTE(SUBSTITUTE($A2," ",REPT(" ",99))," #","|",COLUMNS($C$1:C1)),FIND("|",SUBSTITUTE(SUBSTITUTE($A2," ",REPT(" ",99))," #","|",COLUMNS($C$1:C1)),1)+1,99))
Should be copied down and right as much as needed.
In column B then a CONCATENATE approach can be implemented as below (example for 10 cells).
=SUBSTITUTE(TRIM(CONCATENATE(C2," ",D2," ",E2," ",F2," ",G2," ",H2," ",I2," ",J2," ",K2))," ",", ")
To be copied down.

Use > or < sign dynamically in an excel formula

I am trying to create a formula which picks ">" or "<" sign depending upon whether any record has "Higher" or "Lower" against it.
For example, if A1 has "Higher", then formula in B1 should be =0.78>0.59
If A2 has "Lower", then formula in B2 should be =0.78<0.59
Try,
if(a1="higher", 0.78>0.59, 0.78<0.59)
'alternate
=or(and(a1="higher", 0.78>0.59), and(a1="lower", 0.78<0.59))
use this as formula.
=IF(A1>B1,">","<") in cell C.
than use this formula to get your desired look in next cell. =CONCATENATE(A2,C2,B2)
You can hide Column C if you don't want to show it.
Check it by clicking following link,

Resources