How to count the number of question mark in Numbers? - numbers

I want to count how many rows contains '?' in a column in Numbers(MacOS) .
I use COUNTIF(COLUMN1, "=?").
However, '?' is a wildcard in Numbers, which means any cell contains exact one character will be counted by this formula.
I also tried to use "=\?" but didn't work here.
Example:
COUNTIF(COLUMN1, "=?")=3
But I want just count the number of '?', so the result should be 2
Please help.
Thank you.

I find the solution myself.
Using '~' solve the problem:
COUNTIF(COLUMN1, "=~?")

Related

How to take substring

I have a list, and I need to take only first words including numbers of every row without anything after numbers. How can I achieve that?
A pic is provided
For example:
I have a row like this:
ЛУ 344 ул.Яссауй в районе дома №163 северном направление
As a result I want to get:
ЛУ 344
Left, right won't help because the number of characters can change.
You can use a regex based substring() variant:
substring(the_column from '\w+\s+[0-9]+')
This will extract the first "word characters" followed by one or more spaces followed by one or more numbers
Online example
Maybe split_part() will help.
Or the string_to_array()
Or the substring()
Depends on the use you want and the way you want to get the substring.

Libreoffice calc, how to iterate over cells

I like the program suite from LibreOffice.
I am trying to make a script/code/formula in LibreOffice calc that can count the number of words in the cells such as in the cell selection E5 to AT14
Something like this:
=LEN(E5:AT14)
=SUM(E5:AT14)
I don't know how to do it and I can not put them together, does anyone know how to do it? It may also be similar in excel if you know how to do it there.
Thanks !
A simple way to count words in cells is to count the number of spaces and then add one, as explained by #Lyrl at https://superuser.com/questions/904590/libreoffice-how-to-count-words-and-characters-in-cells.
This works, replace the cell names with the cells you want to affect, and it counts the letters.
=SUMPRODUCT(LEN(E5:AT14))
Thanks for also explaining how to count the words instead of letters.

How do I remove the first or last n characters from a value in q/ kdbstudio?

I've looked into the underscore for drop/cut, but this only seems to remove the first or last n entries, not characters. Any ideas?
Depends on what you're using drop cut on.
Can you provide an example of your values?
Below shows how cut can be used on a sting and then a list of strings.
It uses each right to drop a value from each item.
http://code.kx.com/q/ref/adverbs/#each-right
q)1_"12456789"
"2456789"
q)
q)1_("12456789";"12456789")
"12456789"
q)
q)1_/:("12456789";"12456789")
"2456789"
"2456789"
#Connor Gervin had almost what I wanted, but if you want to cast back to a string, you can use `$(-3)_'string sym from tab

Is a character in a variable is a letter or number

I would like to find out how you can tell if a character in a variable is a letter or number
for example:
if I used the code: ABC123
How would I find out if a variable followed that pattern so if a inputted code would be DNM567 it would print "correct"
But if a code was DNM56T it would print "incorrect".
Many thanks
You can use regular expressions, or linearly scan the character array to ensure that no letter comes after a number.
More information about the question would be helpful.
you can use regular expression:
if(Regex.IsMatch(myString, "^[A-Za-z]{3}[0-9]{3}$"))
{
// you got the right pattern...
}
edit: this is C# but regular expression can be found in almost any OOP language out there.

crystal reports : substring error

I've developed a workaround since crystal reports doesn't seem to have a substring function with the following formula:
right({_v_hardware.groupname},
truncate(instr(replace({_v_hardware.groupname},".",
","), ","))
What I'm trying to do is search for the period (".") in a string and replace it with a comma. Then find the comma position in the string and print all characters following after the comma. This is assuming the string will only have 1 period in the entire string.
Now when I attempt to do this, I get some weird characters which look like wingdings. Any ideas?
thanks in advance.
I don't know the entire issue that you are attempting to accomplish, but for this question alone, the step of replacing the period with a comma seems to be unnecessary. If you know that there is only one period in the string and you only want the characters right of the period then you should be able to do something like the following (this is #first_formula):
right({_v_hardware.groupname}, len({_v_hardware.groupname}) - instr({_v_hardware.groupname},"."))
If for some reason you want to show the comma then I'd do that in a separate formula. If you need the entire screen with the comma replaced then just do:
replace({_v_hardware.groupname},".",",")
And if you need the comma plus included in the string then it might just be easier to do something like:
"," + {#first_formula}
Hope this helps.