count number of dates a single cell have - google-sheets

I have been trying to count the number of dates a single have and using below formula but its not working any help will be appreciated.
=LEN(FORMULATEXT(A5))-LEN(SUBSTITUTE(FORMULATEXT(A5)," ",""))+1

This will split then count the number of columns in the split-out result:
It's using commas, spaces or carriage returns as the delimiters.
=IFERROR(COLUMNS(SPLIT(A5,", "&CHAR(10))),0)

Related

Is there a formula that will count how many times "#" is used in a cell?

I have a spreadsheet with a column of cells that each cell contains multiple emails. I want to create a formula that will give me a total of all emails in each cell.
Cell A1 Contains ("email#msn.com,email#gmail.com,email#fun.com")
I'd like help in figuring out how to count the number of emails in A1 which would be "3". Can this be done by counting the # sign?
I have a very large spreadsheet with thousands of emails that I need to total.
I have tried CountA, Count, Search but can't figure this out.
Thanks in advance for any help
You could try:
=LEN(A2) - LEN(SUBSTITUTE(A2, "#", ""))
This compares the length of the original cell to the length with all # synbols removed, to infer the number of # symbols.

Filter a string based on a variable number of substrings in Google Sheets

I have a cell with a variable number of substrings separated by a comma.
To search:
"first,second,third"
"primero,segundo,tercero,cuarto"
"eins,zwei"
and I have a column with many strings that are composed by some of the substrings:
Column with full items
"first,second,third,fourth"
"primero,segundo,tercero,cuarto,quinto"
"primero,tercero,cuarto"
"eins,zwei,drei"
...and so on...
I would like to find the items of the Column above which has the substrings to be searched. Not a big issue when the amount of substrings is fixed but when it varies it becomes harder. I have a horrible formula that counts the number of commas and then it uses IF for each amount of substrings to search and several FIND(index(SPLIT(A4,","),2) for each substring. The formula is gigant and hard to handle.
Can you think of a better way of doing it?
Here there is an example of what I would like to do. The blue cells are the ones that should have the formula.
https://docs.google.com/spreadsheets/d/1pD9r4JF48cVSNGqA4D69lSyasWxTvAcOhWWu1xW2mgw/edit?usp=sharing
Thanks in advance!
Thank you all for your help! In the end, I used the QUERY function.
=QUERY(E:F,"select E where F contains '" & textjoin("' AND F contains '",TRUE,split(A2,",")) &"'" )
If you are interested, you can see the solution applied in the original spreadsheet :)

Google Sheets Split / Trim From First Letter

I have a list of IDs like this :
40316C1
40316433D112
4316C1
4Z2
40316B2
40310
I would like to return the IDs like this:
40316
40316433
4316
4
40316
40310
Basically, from the first alphabet Character, Trim or Split the rest on the right.
Can I do this in Google Sheets?
You can do it with REGEXEXTRACT
Sample:
=REGEXEXTRACT(A1,"\d{1,20}")
This formula will evaluate the first 20 characters of the IDS (you can change 20 to ahigher number if necessary`
\d means that the formula will extract only numbers from the IDs - until it finds the first non-number.
UPDATE:
The case of no text characters existing in the cell can be caught with =IFERROR
=IFERROR(REGEXEXTRACT(A5,"\d{1,20}"),A5)+0

CONCATENATE cells in the column with ARRAYFORMULA

CONCATENATE cells in the column which separated by empty cells using ARRAYFORMULA. I have an idea but am not sure it is right. First of all get row number of first and last names for each day. Combine them in formula and finally put that formula to ARRAYFORMULA.
D2= =ARRAYFORMULA(IF(B2:B<>"",ROW(B2:B)+1,""))
E2= =ARRAYFORMULA(IF(C2:C<>"",IF(C3:C="",ROW(B2:B),""),""))
So the question is how to get the row number of the last name for each day in the same row as a day and how to combine this number to a formula which can be compatible with ARRAYFORMULA.
Example:
To get to the result (with steps in between) try (in a empty column in row 2)
=ArrayFormula(If(right(B2:B, 3)="day", offset(B2:B, 1,1)&", "&offset(B2:B, 2,1),))
and see if that works ?

Count all nonwhite character

I'm trying to count number of items in given table. But table may consist cell with different whitespace chars.
I would like to do count, but only consider cell with letters and number.
I was trying to do
COUNTIF(<range>, "?*")
Is there any list of available wildchars provided by google-spreadsheet ? I need "*" but matching only numbers and letters.
Maybe use regexmatch to match letters or digits ?
=ArrayFormula(sum(N(regexmatch(A2:L18&"", "\w|\d"))))
Change the range to suit.
See also this spreadsheet

Resources