how to add comma separated numbers in excel column? - excel

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.

Related

Using Excel formulas compare 2 columns and match if there is a substring

Struggling to do this in Python so trying Excel formula.
these are the logic steps I would like to do:
Convert both columns to lowercase
if keyword matches any cell/s in the data string data string then identify the keyword and data string match and and put in another cell.
If there are no matches for the keyword then can put not found
How can I do this?
input example below: (as you can see data strings can be in any order)
output example:
output example:
Thank you!
Based on your revisions...
You will need to type the correct value for d2. Then in d3 and going down, you can use this formula.
=IF(OR(SUM(--ISNUMBER(FIND(D2,$B$2:$B$7)))=COUNTIFS($D$1:D2,D2),SUM(--ISNUMBER(FIND(D2,$B$2:$B$7)))=0),INDEX($A$2:$A$7,MATCH(D2,$A$2:$A$7,0)+1),D2)
Then in e2 and going down, you can use this formula
=IFERROR(INDEX($B$2:$B$7,SMALL(IF(ISNUMBER(FIND(LOWER(D2),LOWER($B$2:$B$7))),ISNUMBER(FIND(LOWER(D2),LOWER($B$2:$B$7)))*ROW($B$2:$B$7)-1),COUNTIFS($D$1:D1,D2)+1)),"not found")
Remember to enter both of the formulas with control + shift + enter

Remove values in a cell based on a string part

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

Splitting the text of a single cell and using it as source for a validation list without VBA

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

Searching within a list of strings with anything in another list of strings in Excel

Example Data
I need to find anything in column B within the strings in Column A and output the cell in Column A in Column C.
I know if it is a short list I can do the highlight cell if a text contains x with Conditional Formatting. However, I have a long list of items that I need to check within the strings of another list.
Let me know if anymore detail needs to be provided. Any help is appreciated. Thanks.
Try this Array formula with wildcards:
=IF(ISNUMBER(MATCH(1, IF(ISNUMBER(SEARCH("*"&$B$1:$B$3&"*",A1)),1,0),0)),"Y","N")
It is an array and need to be confirmed with Ctrl-Shift-Enter.
The search area represented in this small example, $B$1:$B$3 when enlarged must be to the exact range of lookups or it will not return correct values.
You can do this with array formula, type the following in cell C1, then press Ctrl + Shift + Enter:
=INDEX(B:B,MATCH(TRUE,FIND(B:B,A1)<>"#VALUE!",0))
Drag it down column C to match number of rows in column A. You can then put a conditional formatting/filter to see what row in A has substring in B.
If you simply want a yes/no result, enter the following into D1:
=IF(COUNTIF(C1:C6,"<>0")>0,"Found","Not Found")

Count Numerical Values Separated by Comma

Is there a formula to count the number of numerical values that are separated by a comma in a single cell?
http://support.microsoft.com/en-us/kb/187667
Assuming string in A1:A1... but you can alter to just be a cell or a range...
=SUM(LEN(A1:A1)-LEN(SUBSTITUTE(A1:A1,",","")))/LEN(",")+1
This can be done easily by searching the finding the number of commas in the cell and adding 1.
If the cell you want to search is A1 then use this:
=LEN(A1)-LEN(SUBSTITUTE(A1,",",""))+1

Resources