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
Related
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))
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
I have in Column C2, formula results which I need to perform LEFT on in order to trim the cell formula value
The formula result MUST have one of the following (. OR _ OR -) in answer
If one of the above exists in the cell , then LEFT(C2,FIND("the_variable_in_the_formula_answer),C2)-1)
My VBA isn't the best, but I think I could use
variable = Left(Sheet1.[C2],InStr(Sheet1.[C2],".")-1)
I don't know how to make the .(period) , _(underscore) OR -(hyphen) a variable to look for
Try this formula at row two and fill down the column:
=IFERROR(LEFT(Sheet1!C2, AGGREGATE(15,6,SEARCH({".","-","_"},Sheet1!C2),1)-1), "")
It truncates until the first found of {".","-","_"}. If you want to truncate till the last found, change 15 into 14.
For your additional requirements:
=IF(ISNA(C2), D2,
IFERROR(LEFT(Sheet1!C2,AGGREGATE(15,6,SEARCH({".","-","_"},Sheet1!C2),1)-1),C2))
What I am trying to do is concatenate two cells, then check that concatenated value against a column of values, and put an X in a cell if such a value exists. The following equation is what I'm using:
{=IF(CONCATENATE(A2, " ", B2) = 'MasterList'!$C:$C, "x", "")}
Column A is the name of the software and Column B the version number (A="Microsoft .NET Framework 4.5.1", B="4.5.50938", for example). I know that this concatenated value exists on the MasterList worksheet so I don't understand why I'm not getting the answer I expect.
Gurus, what's my flaw here?
The fastest comparison/lookup on the worksheet is a MATCH function. If you have a long column to put this formula into you could try,
=IF(ISNUMBER(MATCH(CONCATENATE(A2, " ", B2), 'MasterList'!$C:$C, 0)), "x", "")
Fill down as necessary.
It seams that you select the entire column C on yout MasterListSheet. Don't you mean just one cell? Like:
=IF(CONCATENATE(A2, " ", B2) = 'MasterList'!$C1, "x", "")
or try to : =IF(CONCATENATE(A2, " ", B2) = MasterList.!$C1, "x", "") (on open Office)
Best thing is instead of you write the Sheet name, let Excel do it for you by editing the formula, remove the sheet name and then with a mouse click navigate to the desired area.
I just want to say that before seeing this question, I had no idea what array formulas were.
I have the following working example:
Sheet1:
A1: Microsoft .NET Framework 4.5.1
B1: 4.5.50938
// press control-shift-enter after typing formula
C4: =IF(CONCATENATE(A1," ",B1)=Sheet2!$A:$A,"YAY","NAY")
Sheet2:
A1: Microsoft .NET Framework 4.5.1 4.5.50938
Not sure what the issue is with your spreadsheet. Do the values in MasterList!$C:$C actually correspond to what you expect as the result of the concatenation?
This is not a valid array formula. The LHS is a single cell while the RHS is an array. What it actually does is compare the concatenation to all cells of columns C in MasterList.
You either need to make it a valid array formula or a normal formula. I recommend the second solution.
For the first solution, it should be:
{=IF(CONCATENATE(A:A, " ",B:B ) ='MasterList'!$C:$C, "x", "")}
However, this will be very slow because it will compute and concatenate two full columns, and moreover you will have to select your whole range where you want to calculate it (a full columns) then press Ctrl+Shift+Enter.
You can make it a simple formula in on cell then copy/paste along your column. Formula for C2:
=IF(CONCATENATE(A2, " ", B2) = 'MasterList'!$C2, "x", "")
I'm looking for a way to unpack an excel formula into a formula that depends only cells that don't refer to other cells.
Example: in the spreadsheet below, cell A1 contains the formula "B1 + B2". Meanwhile, cell B1 contains the formula "C1 + D1", while B2 contains the formula "C2 + D2". Cells C1, C2, D1 and D2 are all constants (in this case, the values 1, 2, 3 and 4).
What I want: I'm looking for a way (either already built into excel, or a user-defined function in VBA), that would function like this:
Call: =ExplodeFormula(A1)
Returns: "C1 + D1 + C2 + D2"
Any chance someone can help me out here? Thanks!
(Edit) A few things I think will be needed for this:
Some way to distinguish a cell reference in a formula from the functions used in that formula.
Some way to distinguish a range reference from a single cell reference (if a cell is referring to a range, like it would in the case of a vlookup, I'd be fine stopping at that level.
A way to iterate through the portions of the formula identified in parts 1 and 2 and break them down into simpler chunks that are recursively run through the same process.
You would have to build an Excel formula parser and apply it recursively to the formulas referred to by any references found in the original formula. And watch out for circular and repeated references!
There are a few formula parsers around, see for starters:
http://ewbi.blogs.com/develops/popular/excelformulaparsing.html
and as a matter of curiosity: why would you want to do this?