I have a column in Excel that contains a series of comma delimited values. The number of values in each row is different and the values I'm searching for can be in different positions within the cell. I would like to remove some of those values based on based on a string part.
Example cell:
2006CE3, 2007CE3, 2012CE1, 2012CE3, 2013CE1, 2013CE3, 2014CE2, 2015CE3, 2016CE2, 2019FA, 2020SP
Specifically, remove all values containing "CE". In the example above, I would like to remove 2006CE3, 2007CE3, 2012CE1, 2012CE3, 2013CE1, 2013CE3, 2014CE2, 2015CE3, 2016CE2, and leave 2019FA, 2020SP
To do this with a formula one will need TEXTJOIN:
=TEXTJOIN(", ",TRUE,IF(ISNUMBER(SEARCH("CE",FILTERXML("<z><y>"&SUBSTITUTE(A1,",","</y><y>")&"</y></z>","//y"))),"",TRIM(FILTERXML("<z><y>"&SUBSTITUTE(A1,",","</y><y>")&"</y></z>","//y"))))
Please try this formula solution of which using TEXTJOIN function available for Office 365
In B2, enter formula :
=TEXTJOIN(", ",1,INDEX(FILTERXML("<a><b>"&SUBSTITUTE(A2,", ","</b><b>")&"</b></a>","//b[not(contains(.,'CE'))]"),0))
Related
I have the following in my first 3 columns of my sheet in excel:
Results table. C3 is where I want the concatenation done
I also have the following table:
Now I am trying to use concatenate to retrieve the items from table 69 using the following conditions:
Spec = the value in B1 (Yellow in first photo)
Slot = each of the values in column A (A2:A18)
this is the formula I have in C2:
=CONCATENATE(IF(AND(Table69[Spec]=$B$1;Table69[Slot]=A2);Table69[Item];"")& ",")
Can anybody help me with this as this formula for the moment is returning as if there was no values?
Try using commas instead of semicolons. Once you do that your formula should return "Icon of the Silver Crescent,".
As a side note, the ampersand "&" sign will do the same thing as the concatenate formula. You are adding a comma at the end of your function.
I found an answer using Text join.
Thank you all that took the time.
=TEXTJOIN(", ";TRUE;IF((Table69[Spec]=$B$1)*(Table69[Slot]=A2);Table69[Item];""))
I am Looking to concatenates multiple cells into one by Index-matching the criteria
The below formula is not pulling in all the required UPCs against the specified criteria
=INDEX($B:$B,MATCH($D:$D,$A:$A,0))
I would like the end result to look like COL E2 in the below image with semi-colons in between every value ;
Any help here would be much appreciated.
If you have Office365 then use TEXTJOIN() with FILTER() function.
=TEXTJOIN(";",TRUE,FILTER($B$2:$B$15,$A$2:$A$15=D2))
Edit: Assuming you don't have access to O365 dynamic formulas. Then try below array formula.
=TEXTJOIN(";",TRUE,IF($A$2:$A$15=D2,$B$2:$B$15,""))
Press CTRL+SHIFT+ENTER to evaluate the formula as it is an array formula.
An alternative approach using the CONCAT function:
=CONCAT(FILTER(B:B, A:A=D2)&";")
Explanation:
The FILTER logic is just like Harun24HR suggested. Creating an array of all the values in B where the value in A is equal to D2.
The & operator works on each element in the array and adds a delimiter ";" to each value.
Finally, the CONCAT function combines all of the elements in the array into a single string.
I am trying to figure out how to remove duplicate values from with an Excel cell. My columns have values separated by a semi-colon. For example, in Column A I have these 3 rows with the values below.
3;5;6
2;2;4
9;5;12;12
What I am wanting to do in an adjacent column, call it column B, have a formula that returns:
3;5;6
2;4
9;5;12
What formula or function would I need to use to achieve this?
The following formula can work with some limited conditions:
-using >= excel2019 version.
-all numbers in the strings > 0.
-all numbers in the string are integer.
-the maximum number in the string = 10^6
You can change $1:$10 or $1:$100,..
C2=TEXTJOIN(";",,IF(1=FREQUENCY(IFERROR(MATCH(ROW($1:$10),--TRIM(MID(SUBSTITUTE(B2,",",REPT(" ",LEN(B2))),(ROW(INDIRECT("A1:A" & 1+ LEN(B2)-LEN(SUBSTITUTE(B2,",",""))))-1)*LEN(B2)+1,LEN(B2))),0),1000),IFERROR(MATCH(ROW($1:$10),--TRIM(MID(SUBSTITUTE(B2,",",REPT(" ",LEN(B2))),(ROW(INDIRECT("A1:A" & 1+ LEN(B2)-LEN(SUBSTITUTE(B2,",",""))))-1)*LEN(B2)+1,LEN(B2))),0),1000)),ROW($1:$10),""))
If you have office 365 then you can try below formula and see if it helps you with your requirement.
=TEXTJOIN(";",TRUE,(UNIQUE(FILTERXML("<t><d>"&SUBSTITUTE(A2,";","</d><d>")&"</d></t>","//d"))))
For FILTERXML part, I will recommend going through below link on stackoverflow which creates array of individual elements from base string:
Excel - Extract substring(s) from string using FILTERXML
Rest of the structure is pretty standard which uses UNIQUE to get list of unique items and then we join them back together using TEXTJOIN.
Another Office 365 or Excel 2019 formula solution
In B1, array (CSE) formula copied down :
=TEXTJOIN(";",1,IF(ISNUMBER(FIND(";"&ROW(A$1:A$9999)&";",";"&A1&";")),ROW(A$1:A$9999),""))
How do I get the desired_output for a given input column containing comma-separated single numeric values as shown in the picture?
Thanks for your help!
Assuming you have your comma-separated values in cell A1, the following array formula will add all such values:
=SUM((TRIM(MID(SUBSTITUTE(A1,",",REPT(" ",255)),1+(ROW(A1:A999)-1)*255,255)) & "0")/10)
To properly return the formula, you need to press CONTROL+SHIFT+ENTER, instead of just the usual ENTER.
Im trying for some hours already to split a text cell into a usable object to the validation list.
The cells today are populated by 3 or more (N) comma (I can change that to semicolons, pipes...) separated values like "1,2,3" or "5,test,8,new"
I want to transform that into a validation list with N different values.
In the following post there is a formula that splits a string into and array, but I have not managed to use it as source:
Split a string (cell) in Excel without VBA (e.g. for array formula)
Is it possible to create a Dynamic Range from splitting the cell text and feeding it into a 'combobox' (validation list).
Another similar example of what I am looking for but without VBA:
Excel Dynamic Drop Down Using Comma Delimited Data
What am I doing wrong here? Thanks for reading this far.
You can do this by
Use a formula to break up the comma separated list into separate cells
Then use dynamic range names to refer to the DV List
Formula
to return an array in the sequence of {1,99,198,297, ...}
Create a defined name formula: (Formulas --> define name)
seq_99 Refers To: =IF(ROW(INDEX($1:$65535,1,1):INDEX($1:$65535,255,1))=1,1,(ROW(INDEX($1:$65535,1,1):INDEX($1:$65535,255,1))-1)*99)
With your lists in row 1 on some worksheet, use the following formula:
A2: =INDEX(TRIM(MID(SUBSTITUTE(A$1,",",REPT(" ",99)),seq_99,99)),ROWS($1:1))
and fill down as far as needed to account for your longest list. I assumed A2:A10 would be sufficient.
Next, create dynamic named formulas to refer to just the portion of each list that contains data.
Example:
dvList1 Refers to: =OFFSET(Sheet2!$A$1,1,0,COUNTA(Sheet2!$A$1:$A$10)-COUNTBLANK(Sheet2!$A$1:$A$10)-1)
Format your DataValidation cell as a List with the named formula:
The list will now show the non-blank entries.
It is possible to formulate this using Find. To split the text in cell "A1", the formula will be:
1st part - cell B1 formula:
=LEFT(A1,FIND(",",A1)-1)
2nd part - cell C1 formula:
=MID(A1,FIND(",",A1)+1,FIND(",",A1,FIND(",",A1)+1)-FIND(",",A1)-1)
3rd part - cell D1 formula:
=MID(A1,FIND(",",A1,FIND(",",A1)+1)+1,999999)
Then a list validation may be added to Cell E1, with the range B1:D1