Could anyone enlighten me on how to count the number of digits (numbers) in a cell in Excel?
I have tried LEN and SUBSTITUTE and could not get it to work..
For example a cell has a mix of text and numbers: b72a037h, the formula would take into account 7,2,0,3,7 and return 5.
Is it possible to create such a formula?
Many thanks in advance.
One approach would be to remove all digits one by one using SUBSTITUTE, and then compare the resulting length against the original length. The difference would give the number of digits:
=LEN(A1) - LEN(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(
SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1, CHAR(48), ""), CHAR(49), ""), CHAR(50), ""),
CHAR(51), ""), CHAR(52), ""), CHAR(53), ""), CHAR(54), ""), CHAR(55), ""), CHAR(56), ""),
CHAR(57), ""))
Or try this array formula (CTRL+SHIFT+ENTER)
=COUNT(-MID(A1,ROW($1:$99),1))
Related
The challenge is to find the number between "produto_id:" and the last character, which is sometimes a "]" or a " , ". When it's a "]", it does extract the text, but it doesn't when it's a comma.
The cell value:
linha:2,quantidade:2,preco_cheio:19.9000,preco_promocional:null,preco_venda:19.9000,preco_custo:null,produto_id:27319353,
The formula I'm using, which works when the last character is a ]:
=IFERROR(VALUE(MID(LEFT($AV9;SEARCH("]";$AV9)-1);SEARCH("produto_id:";$AV9)+11;LEN($AV9)));"")
For the occurrences ending in a comma:
=IFERROR(VALUE(MID(LEFT($AV9;SEARCH(",";$AV9)-1);SEARCH("produto_id:";$AV9)+11;LEN($AV9)));"")
I'd appreciate if you could give it a glance and let me know where I'm failing.
Thanks.
Antonio here is a solution for your problem:
Portuguese formula:
=SUBSTITUIR(SUBSTITUIR(EXT.TEXTO(A2;LOCALIZAR("produto_id:";A2;1)+11;NÚM.CARACT(A2)-(LOCALIZAR("produto_id:";A2;1)+10));",";"");"]";"")
English formula:
=REPLACE(REPLACE(MID(A2;SEARCH("produto_id:";A2;1)+11;LEN(A2)-(SEARCH("produto_id:";A2;1)+10));",";"");"]";"")
replace A2 for your cell.
Give a try on below FILTERXML() formula.
=FILTERXML("<t><s>"&SUBSTITUTE(FILTERXML("<t><s>"&SUBSTITUTE(SUBSTITUTE(A1,",","</s><s>"),",","</s><s>")&"</s></t>","//s[contains(., 'produto_id:')]"),":","</s><s>") & "</s></t>","//s[last()]")
In B1, formula copied down :
=MID(A1,SEARCH("produto_id",A1)+11,LEN(A1)-SEARCH("produto_id",A1)-11)
Formula in column B:
=LEFT(A2, FIND(" ", A2, FIND(" ", A2) + 1) - 1)
Formula in column C:
=IF(B2<>"Null",B2,A2)
I want to be able to return the 2 word name in column C and am struggling to find how. Any tips?
Thank you in advance!
=IF(LEN(A2)-LEN(SUBSTITUTE(A2;" ";""))>1;LEFT(A2;(LEN(A2)-LEN(RIGHT(A2;FIND(" ";A2)))));A2)
I believe that this is what you're looking for. In the formula, if the number of " " is more than one, it only takes the first two words into account. Otherwise, it just rewrites the input.
I hope that will work!
This will return only the first two words:
=LEFT(A1,FIND("}}}",SUBSTITUTE(A1&" "," ","}}}",2))-1)
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 am using a trim formula in excel:
TRIM(LEFT(SUBSTITUTE(MID(M2,FIND("|",SUBSTITUTE(M2,"-","|",2))+1,LEN(M2)),"-",REPT(" ",LEN(M2))),LEN(M2)))
this looks for a number in between a string of 4 numbers:
193449542-27309370502-9045796-169794419204
which works perfectly.
I want to add an if= when a another cell on that same row contains either "bing" or "Adwords" and skip cells that contain it.
In H2 per the supplied image,
=IF(NOT(SUM(COUNTIF(J2, "*"&{"bing","Adwords"}&"*"))), TRIM(LEFT(SUBSTITUTE(MID(M2,FIND("|",SUBSTITUTE(M2,"-","|",2))+1,LEN(M2)),"-",REPT(" ",LEN(M2))),LEN(M2))), "")
To add a condition where M2 must contain at least three hyphens, use AND and subtract the length of substituting the hyphens with "" (subtrahend) from the length of the original (minuend). If the result (difference) is 3 or more then there are at least three hyphens.
=IF(and((len(m2)-len(substitute(m2, "-", "")))>=3,NOT(SUM(COUNTIF(J2, "*"&{"bing","Adwords"}&"*")))), TRIM(LEFT(SUBSTITUTE(MID(M2,FIND("|",SUBSTITUTE(M2,"-","|",2))+1,LEN(M2)),"-",REPT(" ",LEN(M2))),LEN(M2))), "")
I want to extract string before "_" or "." characters.
e.g..
My C column can have following values and expected output in E:
C E
115415.csv 115415
12345_BOI_CEO.csv 12345
I have a formula for "_" i.e.
IFERROR(LEFT(C10, FIND("_", C10)-1),"")
So I want a formula which would extract string before the character mentioned in a single formula and not separate formula.
It seems you were on the right track. Put one of the following standard formulas in E2,
=REPLACE(C2, MIN(FIND(".", C2&"."), FIND("_", C2&"_")), LEN(C2), TEXT(,))
=LEFT(C2, MIN(FIND(".", C2&"."), FIND("_", C2&"_"))-1)
Standard formula in F2 as,
=MID(C2, IFERROR(FIND("_", C2)+1, 1), FIND(".", C2)-IFERROR(FIND("_", C2)+1, 1))
Fill down as necessary.
Another way
=MID(C2,1,MIN(SEARCH(".",C2&"."),SEARCH("_",C2&"_"))-1)
If you intend to do this once, we could use the Text to Columns menu option twice.
First split by _(underscore), then again by .(dot). See below for the first step.