Is there a way to extract multiple strings between specific characters in excel and separating them with a comma.
For example:
I am thankful for every help!
The following requires a version of Excel O365 that supports dynamic arrays and the LET function.
If I understand correctly you are looking for something like this.
This formula will list all the positions of all [ in the string using dynamic array functions.
=LET(x,$B$2,
y, SEQUENCE(LEN(x)),
raw, IF(MID(x,y,1)="[",y,""),
filtered, FILTER(raw,raw<>"",""),
filtered)
LET allows you to set names within a formula using parameter pairs. The first is the name; the second is the value of the name. The last parameter is the value returned. In this case, x is set to cell B2. y is set to the array listing the numbers from 1 to the length of x using the dynamic array function SEQUENCE. raw is a list that shows the value of y if that position is [, otherwise it is blank. filtered uses the FILTER function to remove all of the blank rows. filtered is the last argument of the LET function so that is what is returned. If this formula is entered into cell A4 then A4 will show 1, A5 will show 14 and A6 will show 28.
If you then enter a similar formula in B4 replacing [ with ] then the result is {7,21,35} in cells B4, B5 and B6.
Finally, in cell B2 you can enter =TEXTJOIN(", ",TRUE,MID(A2,A4#+1,B4#-A4#-1)). This will return the result you are looking for.
If you are unfamiliar with dynamic arrays, A4# indicates an entire dynamic array starting in cell A4. In this case, it is the same as A4:A6.
More information on Dynamic Arrays
More information on LET
You can't do it with only formulas in Excel 2007. You need VBA UDF then. With Excel O365 having dynamic formula access, this can be done like:
=TEXTJOIN(", ",TRUE,TRIM(LEFT(FILTERXML("<t><s>"&SUBSTITUTE(SUBSTITUTE(A1,"]",REPT(" ",100)),"[","</s><s> ")&"</s></t>","//s[starts-with(., ' ')]"),100)))
Considering that you are using too old version of excel which lacks dynamic array functions and besides too many other useful functions, You may probably have to do a long workaround here.
First using substitute and len You have to find out number of such square parenthesis in each of the row. Thereafter you have to work out the formula of max of such numbers.
Do it like this
Assuming your text-values in A2 for a max of 4 occurrences enter the following formula in B2
=SUBSTITUTE(TRIM(REPLACE(LEFT(A2,FIND("]",A2&"]")-1),1,FIND("[",A2&"["),"")&" "&REPLACE(LEFT(A2,FIND("#",SUBSTITUTE(A2&REPT("]",2),"]","#",2))-1),1,FIND("#",SUBSTITUTE(A2&REPT("[",2),"[","#",2)),"")&" "&REPLACE(LEFT(A2,FIND("#",SUBSTITUTE(A2&REPT("]",3),"]","#",3))-1),1,FIND("#",SUBSTITUTE(A2&REPT("[",3),"[","#",3)),"")&" "&REPLACE(LEFT(A2,FIND("#",SUBSTITUTE(A2&REPT("]",4),"]","#",4))-1),1,FIND("#",SUBSTITUTE(A2&REPT("[",4),"[","#",4)),"")), " ", ", ")
Let's say this is the text in A2
I have a text [123] and some more [4523] and also [552222] how to extract [22]?
This will create a output of 123,4523,552222,22 in B2
There is no "extraction" in your question, just removal. The formula below replaces the unwanted characters with "", thereby removing them. Please try it.
=SUBSTITUTE(SUBSTITUTE(A2,"[",""),"]","")
I have a string let's say "Adam". The formula must withdraw UNICODE value of each character and sum it up. This must be done using CSE(Array formulas). Could anyone help me?
Here's how you could go:
build 3 columns with input:
A: index to help decompose the Name your working on
B: letters
C: UNICODE value you will add up for your result;
then first formula takes the name and uses MID function with increasing index to decompose each letter in column E; write =MID($D$2;C2;1) in cell E2, then drag formula to the bottom of your sheet.
second formula uses VLOOKUP to take the UNICODE value associated in the green table to the name's letter; write =IF(E2<>"";VLOOKUP(E2;$B$2:$C$14;2;FALSE);0) in cell F2, then drag formula to the bottom of your sheet. - note the use of $ to express a fixed cell, and no $ to express a relative position in the formula
Result is the sum of column described above.
Here is what you should have (I let you, if I may, complete the UNICODE list values for letters):
Hope it helps.
sorry if this has already been asked, have read many answers about this, (this is the one that best describes my situation - Excel - Match cells that contains exact match from list )
I would like Excel to index a column where the cells contain comma separated lists of values. Some lists have only one entry and thus no comma.
I would like Excel to find an exact match for a given string, for example, if I search for "C2" I would like it only to find "C2" and not "C22" or "C230". It should also find "C2,"
I have got this to work for single cells with this formula :
=ISNUMBER(FIND(" "&E$1&", "; " "&$B1&", "))
Where "C2" is contained in cell E1 and the comma separated list is in cell B1.
However, if I try to incorporate this into an INDEX formula (I would like it to return the corresponding value from the cell in column A where C2 exists), it once again finds all instances of "C2". I wrote the formula as follows :
=INDEX(A:A;ISNUMBER(FIND(" "&E$1&", "; " "&B:B&", ")))
If anyone has any advice on how to get this to work, I would be most grateful!
Katrina
Use the =ISNUMBER(FIND(" "&E$1&", "; " "&$B1&", "))function in an auxiliary column, say F, and pull it down along the comma-separated values in B.
Use =INDEX(A:A;MATCH(TRUE;F:F;0)). This will find the first occurrence of C2 or #NV in cases where C2 does not occur.
Note that the function will find "C2" and "C2, " but not "C2,".
=SUMPRODUCT(ISNUMBER(FIND(" "&E$1&", "; " "&B:B&", "))*A:A)
SUMPRODUCT works great with arrays. The ISNUMBER function returns an array of false/0 and true/1 that is then multiplied with the respective value in column A, returning only that value in A where ISNUMBER is true. If there are several occurrences of the E1 value, the sum of the respective values in A is returned.
For better performance the ranges in A and B should be restricted to those where values are possible, say A1:A100 and B1:B100.
I want to get a formula with COUNTIFS, like
=COUNTIF(A1:A3,"<>"&"")
such that when A1 = 2, A2 = "", A3 = empty, it returns 1.
Notes:
A2 contains an empty string, as the result of a formula. A3 is a blank cell, with no formulas in it.
The formula posted returns 2.
I tried using various numbers of double quotes. I always get 2.
I tried using &CHAR(34)&CHAR(34). I get 2.
The solution posted in How do I get countifs to select all non-blank cells in Excel? is what I tried, it returns 2 (not useful).
The formula would actually be =COUNTIFS(range1,cond1,range2,cond2), that is why I cannot use something like
=ROWS(A1:A3)-COUNTIF(A1:A3,"") or =ROWS(A1:A3)-COUNTBLANK(A1:A3) (see this).
range1 and range2 would come from expressions with INDIRECT, but that is probably not relevant.
I have worked it out with =SUMPRODUCT(--(expression1),--(ISNUMBER(A1:A3))), but I am specifically asking about the possibility of using COUNTIFS. Discrimination of number vs. text (e.g.) is not relevant at this point.
Blank vs. Empty string is the source of "troubles" (see, e.g., this).
Excel itself is somewhat ambiguous with respect to the definition of BLANK. In my example, ISBLANK(A2) returns FALSE, but COUNTBLANK(A2) returns 1.
I am not interested in a user Function.
Use a SUMPRODUCT function that counts the SIGN function of the LEN function of the cell contents.
As per your sample data, A1 has a value, A2 is a zero length string returned by a formula and A3 is truly blank.
The formula in C2 is,
=SUMPRODUCT(SIGN(LEN(A1:A3)))
I was having this exact problem, and I just found out about the "?*" wildcard which searches for any one or more characters, thus avoiding the empty string problem--genius! See Jonathan Gawrych's answer (posted right after the selected answer) here:
Excel Countif Not equal to string length of zero
Not sure if this works for the OP, since it looks like the value in A1 could need to be handled as a number not a string, but it might help anyone else who arrived here looking for a text-parsing solution.
Is using SUM instead of COUNTIFS an option? If so, I've found it to be much more flexible for filtering data sets. For example:
=SUM(IF(NOT(ISBLANK(A1:A3)),IF(NOT(ISTEXT(A1:A3)),1,0),0))
(entered as an array formula). IF(NOT(ISBLANK(x))... filters out non-blanks, then IF(NOT(ISTEXT(x))... filters out non-text. Whatever survives the filters is counted by summing 1. You can add as many filters as necessary. If you wanted to filter out only empty strings but include other text entries you could use a filter like
IF(ISTEXT(x),IF(LEN(x)>0,1,0),0)
I have a need to count cells with a particular string of text. I have a list of each string of text to be counted.
I am forming a query using CountIf in the form:
=COUNTIF(C1:C4929,"String")
where every occurrence of 'String' is counted and output.
I would like to show the counts for each string of text in a column alongside the String. I have created a column with one string per cell.
What I would love to be able to do is call the string in the cell into the CountIf function, sort of like:
=COUNTIF(C1:C4929, "Whatever's in the column to the left of this output cell")
But I can't work it out. Am looking and will update here IMMEDIATELY if I work it out.
EDIT:
DONE!
=COUNTIF(C1:C4929,INDIRECT("RC[-1]",0))
Please try =COUNTIF(C1:C4929,"="&D1) copied down from E1, where ColumnD contains your strings.