How to use countif with digits that start with 0?
Hi guys good morning. I have a difficulty with a formula. In the HR area of the company I work for, we use a form to register for vacancies offered throughout Brazil and in this form we request the CPF (Individual Taxpayer Registration Number - number we use to identify a person in Brazil). This number consists of 11 digits, and you can START with any digit, including 0. I would like to make a simple analysis: to identify if the candidate in question is already in our candidate base. I tried to use COUNTIF to count the amount of that specific value across the column. However, it is only working for CPFs that start with digits from 1 to 9. CPFs that start with 0 are not being identified. I would like some help, please. Thanks.
Olá pessoal, bom dia.
Estou com uma dificuldade em uma fórmula.
Na área de RH da empresa que trabalho utilizamos um formulário para cadastro em vagas ofertadas por todo o Brasil e neste formulário solicitamos o número CPF (Cadastro de Pessoa Física - número que utilizamos para identificar uma pessoa no Brasil). Este número é composto de 11 dígitos, podendo INICIAR com qualquer dígito, inclusive o 0.
Gostaria de fazer uma análise simples: identificar se o candidato em questão já consta em nossa base de candidatos.
Tentei utilizar o COUNTIF para contar a quantidade daquele valor específico em toda a coluna. Porém, só está funcionando para os CPF que começam com dígitos de 1 a 9. Os CPF que começam com 0 não estão sendo identificados.
Gostaria de uma ajuda, por favor. Obrigado.
Answers
-
Paul Newcome ✭✭✭✭✭✭
All values being looked at need to be of the same data type. Numbers that start with 1 - 9 are being stored as numerical values, but those that start with 0 are being stored as text values (so the leading zero won't drop off).
To accommodate this, create another text/number column (that can be hidden after setting up to keep the sheet looking clean) and use
=[ID Number Column Name]@row + ""
This will convert everything to text values. Now you can run your COUNTIFS off of this helper column, and you should be getting the correct results.
thinkspi.com
-
Hi Paul, I'm sorry for the delay in replying. I was unable to solve the problem with the suggested solution. But, I added an auxiliary column with the digit 1 and added it with the CPF column. In this way it was possible to do the necessary counting and identification. Thank you very much for your response and help. Big hug.
-
Paul Newcome ✭✭✭✭✭✭
Are you able to provide more detail surrounding your auxiliary column and adding the 1? Exactly how did you do this? Can you provide an example?
thinkspi.com
-
Sadsoft ✭
Hi Everyone!
Can you please help me with this. I'm facing the same problem with my sheet.
These are the formulas I'm using for both counting (helper) and "YES" and "NO" columns.
Any thoughts?
Thank you in advance
-
Genevieve P. Employee Admin
Hi@Sadsoft
I've seen this before when there are leading 0's in a Primary Column.
Try using@cell =before the criteria:
=COUNTIF([Column Name]:[Column Name];@cell = [Column Name]@row)
Cheers,
Genevieve
-
Sadsoft ✭
-
Genevieve P. Employee Admin
Wonderful! Thanks for letting me know
-
Sadsoft ✭
Hi, everyone!
I would like to understand what is the implication/meaning of the use of the "@cell" in the formula.
Also would like to understand how to avoid empty cells to be counted.
Thank you in advance.
-
Genevieve P. Employee Admin
Hi@Sadsoft
Can you post the current formula you're using?
如果你只是使用计数,它会自动exclude blank cells. If you're using COUNTIF, it will only count the values you tell it to (ex. cells that equal "This", which would exclude blank cells).
The @cell tells the formula to checkeach cellin the previously stated range to see if that specific cell = the value. See:Create Efficient Formulas with @cell and @row
Cheers!
Genevieve
-
Sadsoft ✭
-
Genevieve P. Employee Admin
Hi@Sadsoft
Thank you for clarifying!
Since you're specifically looking for a blank cell, your formula will COUNT how many blank cells there are. This is because you're searching for [Referência do Documento]@row, which is blank.
You can add an IF Statement at the beginning to return Blank if the cell is blank:
=IF(Referência do Documento]@row = ""; "";IF(COUNTIF([Referência do Documento]:[Referência do Documento]; @cell = [Referência do Documento]@row) > 1; "SIM"; "NÃO"))
=IF(Referência do Documento]@row = ""; "";COUNTIF([Referência do Documento]:[Referência do Documento]; @cell = [Referência do Documento]@row))
Cheers,
Genevieve
Help Article Resources
Categories
@SarahI<\/a> Yes you can do that just use CHILDREN([COLUMN NAME])<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[]},{"discussionID":106901,"type":"question","name":"Can you use a COUNTIF formula to county symbols?","excerpt":"I have a list of goals for the year and we are using harvey ball symbols to indicate the percent complete an the red, yellow, green, gray balls to indicate the health\/status of the project. I would like to display a report on my dashboard that shows the number of projects we have in each harvey ball stage and also in each…","categoryID":322,"dateInserted":"2023-06-26T15:59:48+00:00","dateUpdated":"2023-06-26T16:00:12+00:00","dateLastComment":"2023-06-26T16:29:45+00:00","insertUserID":162764,"insertUser":{"userID":162764,"name":"Stephanie D","title":"Program Manager","url":"https:\/\/community.smartsheet.com\/profile\/Stephanie%20D","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!mctWfgWrL7o!n-DX3ymVfmQ!msa32mT4_k9","dateLastActive":"2023-06-26T16:52:22+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":162764,"lastUserID":8888,"lastUser":{"userID":8888,"name":"Andrée Starå","title":"Smartsheet Expert Consultant & Partner | Workflow Consultant \/ CEO @ WORK BOLD","url":"https:\/\/community.smartsheet.com\/profile\/Andr%C3%A9e%20Star%C3%A5","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/0PAU3GBYQLBT\/nXWM7QXGD6464.jpg","dateLastActive":"2023-06-26T23:47:23+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":26,"score":null,"hot":3375593973,"url":"https:\/\/community.smartsheet.com\/discussion\/106901\/can-you-use-a-countif-formula-to-county-symbols","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/106901\/can-you-use-a-countif-formula-to-county-symbols","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":106901,"commentID":382346,"name":"Re: Can you use a COUNTIF formula to county symbols?","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/382346#Comment_382346","dateInserted":"2023-06-26T16:29:45+00:00","insertUserID":8888,"insertUser":{"userID":8888,"name":"Andrée Starå","title":"Smartsheet Expert Consultant & Partner | Workflow Consultant \/ CEO @ WORK BOLD","url":"https:\/\/community.smartsheet.com\/profile\/Andr%C3%A9e%20Star%C3%A5","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/0PAU3GBYQLBT\/nXWM7QXGD6464.jpg","dateLastActive":"2023-06-26T23:47:23+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-06-26T16:24:48+00:00","dateAnswered":"2023-06-26T16:08:42+00:00","acceptedAnswers":[{"commentID":382328,"body":" Hi @Stephanie D<\/a> <\/p> I hope you're well and safe!<\/p> Try something like this.<\/p> =COUNTIF(Status:Status, \"Green\")<\/p> =COUNTIF([% Complete]:[% Complete], \"Half\")<\/p> Did that work\/help? <\/p> I hope that helps!<\/p> Be safe, and have a fantastic week!<\/p> Best,<\/p> Andrée Starå<\/strong><\/a> | Workflow Consultant \/ CEO @ WORK BOLD<\/strong><\/a><\/p> ✅Did my post(s) help or answer your question or solve your problem? Please support the Community by <\/em>marking it Insightful\/Vote Up, Awesome, or\/and as the accepted answer<\/em><\/strong>. It will make it easier for others to find a solution or help to answer!<\/em><\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":254,"urlcode":"Formulas","name":"Formulas"}]}],"initialPaging":{"nextURL":"https:\/\/community.smartsheet.com\/api\/v2\/discussions?page=2&categoryID=322&includeChildCategories=1&type%5B0%5D=Question&excludeHiddenCategories=1&sort=-hot&limit=3&expand%5B0%5D=all&expand%5B1%5D=-body&expand%5B2%5D=insertUser&expand%5B3%5D=lastUser&status=accepted","prevURL":null,"currentPage":1,"total":10000,"limit":3},"title":"Trending in Formulas and Functions ","subtitle":null,"description":null,"noCheckboxes":true,"containerOptions":[],"discussionOptions":[]}">