I have a list of telephone numbers in file telephones.txt. There are more over 2000 telephone numbers in that list.
File format: each row contains one telephone number.
I need to find all equal (same?) telephone numbers. The output should contain only telephone numbers which have more than 1 record in the list (I hope I wrote it right in english).
Sample of output:
telephoneNumber count
How can I do this ?
.net 2.0
I would read the list into memory (2000 numbers is small). Sort the list and then walk the list and output the telephone and count when when the previous telephone number does not match the current telephone number.
Related
I built a scraper for the Twitter account of a local transportation network to find out how many bus and tram rides are cancelled each day. All my results are listed in a Google Sheets table. I now want to build one table sheet with the information on all trams and another one with the information on all busses. They differ in their numeration: tram lines are numbered 1 - 20 (in German "Linie 1", "Linie 2", and so on), whereas the bus numbers are greater than 100.
How can I write a filter command to combine text and number range? That*s what I've got so far, but I don't know how to insert the 1-20 or >100 range behind the word "Linie"...
Additional note: As there are other numbers in each tweet, the number has to follow directly after the word "Linie".
=FILTER(Tabellenblatt1!C:D; REGEXMATCH(Tabellenblatt1!C:C; "Linie"))
You can use REGEXEXTRACT to get the numbers after Linie like this:
REGEXEXTRACT(Tabellenblatt1!C:C, "Linie (\d+)")
With INDEX you'll be able to check the whole range, and since REGEXEXTRACT returns a string you can multiply by one to get its value and compare to your desired numbers:
INDEX(REGEXEXTRACT(Tabellenblatt1!C:C, "Linie (\d+)")*1)<=20
Then you can use both conditions summed to get those that are under 20 and more than 100:
=FILTER(Tabellenblatt1!C:D, (INDEX(REGEXEXTRACT(Tabellenblatt1!C:C, "Linie (\d+)")*1)<=20)+(INDEX(REGEXEXTRACT(Tabellenblatt1!C:C, "Linie (\d+)")*1)>=100))
In Google Sheets, I have a sheet with a list of customers.
Row 1 has headers, and data starts in row 2.
Column A is Customer name,
Column B is street address,
Column C is City and Post Code,
Column D is Country.
I would like to count the number of occurrences of each customer's row, i.e. when A, B, C, D are the same as a composite key.
However, I want to count different occurrences of a row ONLY IF those occurrences are not adjacent / concurrent, i.e.
I do want to count separate occurrences if row 5 and 7 have the same customer,
but not if row 5 and 6 have the same customer...in this case I will count it as one occurrence
Sample sheet (Customers) with examples:
https://docs.google.com/spreadsheets/d/1J7WajZjJfl94tpgXXgk0y5ALCwG2PxoJw6poxwUyrU8/edit?usp=sharing
I have added explanations for counts in column N.
Say for example, you want to know the number of contiguous blocks whose column A value equals "O2 Arena", you can do
=countifs(FILTER(A2:A,A2:A<>A3:A),"="&A5)
It works because we want to omit rows where the value in column A is repeated in the next row. In other words, we keep those with different values than their next rows. Hence, A2:A<>A3:A.
If you want a list of counts for unique blocks, I recommend setting up the a list of the unique values first, ie. say in another sheet's A1, you have
=unique(Customers!A2:A)
then in B1, you can do
=countif(FILTER(Customers!$A$2:$A,Customers!$A$2:$A<>Customers!$A$3:$A),"="&A1)
and spread the above formula by double clicking the square on the lower right when you select B1.
The ranges in filter() should be absolute because the location of your data does not change. The range in the 2nd input of countif() should be relative because that is meant to iterate.
If values in column A does not uniquely identify your customers, you can add more columns to the input of filter() as required. For example, FILTER(A2:A,A2:A<>A3:A,B2:B<>B3:B)
For function usage, please consult official documentation by typing the function name in the search bar.
In my iOS project, there is a textfield for mobile number (required filed) and field employees enter placeholder numbers. Before that, basic validations are already done as below:
Here are the validations already done:
Only numbers are allowed run time.
Phone number will at-least 10 digits and not more than that which is checked at submit time.
Here are the things which I need to validate:
Check if string of textfield contains serial numbers or all same
Check if string of textfield contains all same numbers
If logically, serial number logic is not possible, I can go
with only same number restriction.
Is there any REGEX to check what I need?
NOTE: App is used in India only and never outside India.
I made a simple and flawless workaround for it. As I know that this field will have exactly 10 numbers, I just filtered few pre-defines numbers:
+(BOOL)stringIsSerialMobileNumber:(NSString *)text
{
NSArray *array = #[#"0000000000",
#"1111111111",
#"2222222222",
#"3333333333",
#"4444444444",
#"5555555555",
#"6666666666",
#"7777777777",
#"8888888888",
#"9999999999",
#"1234567890",
#"0123456789"];
return [array containsObject:text];
}
I've tried everything and am finally turning to help from this community to figure out this Google Sheets formula. Here is a sample sheet to illustrate the situation: https://docs.google.com/spreadsheets/d/1mLzsAyqtkASYMQsu8-igaUTURvhHiH-jXJN3qsr0mkU/edit?usp=sharing
Each row is a patient that visited a clinic. There are 5 fields for patients to provide phone numbers (cell, home, etc.). On another tab ("Paid Calls") there are phone numbers in column A from leads that called us. As this will be an ever-growing list of patients and calls, I'd like to use an array formula to search across all five phone numbers provided by each patient, compare them to the phone numbers from Col A in Paid Leads and return the value of the first matching phone number. So, if the cell phone of patient 999999 matches any of the phone numbers in the Paid Leads tab, then I want to return that matching phone number.
Because I'm not sure there's a way to do this, I have an alternate scenario that could work where an array formula will return the first non-blank value from columns E through I of each row. If that's an easier formula to write, then I can figure out a way to arrange the data to make that work using a non-related query.
Thank you for any help you can provide!
There's two formulas you can use:
This one compares the phone number of a specific patient with the number list you have in the PaidCalls sheet.
=join(char(10),FILTER(E2:I2,ARRAYFORMULA(ISNUMBER(MATCH(E2:I2,PaidCalls!A2:A,0)))))
The other one simply iterates through each patient's phone numbers and selects the first one which isn't blank. It's pretty straight forward. It's a series of nested conditions, that all follow the following pattern:
If this cell is not blank, use its value. If it is blank, proceed to the next cell.
=IF(not(isblank(E2)),E2,IF(not(isblank(F2)), F2, IF(not(isblank(G2)), G2, IF(not(isblank(H2)),H2, IF(not(isblank(I2)),I2)))))
PS: Please note that I used the name 'PaidCalls' instead of 'Paid Calls' in my implementation. Everything else works according to the structure of your sheet. I also already copied it into the Google Sheet you shared.
Please let me know if you'd like any further explanation, particularly on the first formula.
formula that will return the phone number from this row that matches any phone number from Column A in the Paid Calls tab.
=JOIN(CHAR(10),unique(QUERY(ArrayFormula(IFERROR(VLOOKUP(
{E5;F5;G5;H5;I5},PaidCalls!A$2:A,1,0),)),
"select Col1 where Col1 is not null", 0)))
formula that will return the first non-blank value from columns E through I of each row below
=INDEX(QUERY(transpose(E5:I5),"select Col1 where Col1 is not null",0),1,1)
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