98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel Training and help » Countif formulas and contains criteria
Countif formulas and contains criteria
Resolved · Low Priority · Version 2003
Stacy has attended:
Excel Advanced course
Access Intermediate course
Access Advanced course
Countif formulas and contains criteria
I am trying to write a =countif formula which will count anycell in a column that contains nm. The options for data entry are me, nm, nmfa, nmpa, and mb and I want to count any of the nm options (nm, nmfa, nmpa). Is there a way to write a countif formula where the criteria is anything that contains "nm" or will it have to be 3 seperate formula?
RE: Countif formulas and contains criteria
Hi Stacy
Thank you for your question
I would suggest using the dcounta function. This is a database function and requires you to create a criteria range. By simply entering all the variants of nm into this criteria range.
To create your criteria range type the heading for the column that contains your criteria and then type in the cells beneath.
You can then access the dcounta function from the paste function dialog box. It requires three arguments;
The range of the database
The Column heading of the column that contains the values that you want to count
The criteria range
I have uploaded and example which will hopefully clarify things
Regards
Stephen
Attached files...
RE: Countif formulas and contains criteria
If the data is in rows, not columns, how is it done?
RE: Countif formulas and contains criteria
Hi Stacy
Thanks for the follow up
If the data is in rows then that method won't work. Before I explore other avenues could you create a transposed copy of the data?
To do this select the data and copy to clipboard. Then select the cell where you want the copied data to start. Then on the edit menu and select paste special and select the transpose option. This will then create a transposed version of your data, where rows become columns.
The method that I described above should then work
Let me know if this is not acceptable, so I can explore other angles
Regards
Stephen
RE: Countif formulas and contains criteria
Dear Stacy
Further to my colleague's response I would like to add that you can still use the countIF function and all you have to do is simply use these arguments:
=COUNTIF(C2:C6,"nm*")
* is the wildcard which means that it starts with nm. In your case I saw all the entries had nm at the start of the entry.
If it is in the middle or at the end then you may want to replace it with *nm*.
I hope this has answered your query.
If this has answered your query then I would request you to please mark the question as resolved!! If not and you have a specific question related to this then please post it as a new question and we should be able to provide you the solution for it!!
Kindest Regards
Rajeev Rawat
MOS Master Instructor 2000 and 2003
MCAS Master Instructor 2007
MCT
Tue 21 Apr 2009: Automatically marked as resolved.
Training information:
See also:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Convert Text to Columns in Excel 2010If you have a cell in your Excel spreadsheet that contains a lot of text and you want to divide it into separate columns, this can only be done if there is a logical character which separates the text, for example, a comma. |