How can I use COUNTIF to count rows?
I am linking a report with another spreadsheet and each row in the spreadsheet is labeled either Facebook or Google. In my report, I need the total number of rows for Facebook or Google in order to figure out other calculations for my social media report. I have tried using:
=COUNTIF({Social Media Data 2021 Range 8}, CONTAINS("facebook"))
This comes back as #INVAID OPERATION.
The way I normally see the COUNTIF function used is to collect data from column A if criteria is met in column B , but I just need a total number of rows. Any suggestions on how to accomplish this?
Answers
-
Try this
=COUNTIF({Social Media Data 2021 Range 8}, CONTAINS("facebook", @cell))
Updated - had my " in the wrong spots.
-
Hi Nic. I tried that and even checked the criteria, but it's not working. Still says #INVALID OPPERATION.
=COUNTIF({Social Media Data 2021 Range 8}, CONTAINS("Facebook, @cell"))
Should the @cell count the cells (therefore rows)?
-
Be sure to use the revised formula one I put in there. I had my quotes around @ cell rather than around facebook when I first submitted.
=COUNTIF({Social Media Data 2021 Range 8}, CONTAINS("facebook", @cell))
Is your range a single column? If so, this worked fine for me when I tried it.
You can also run it this way - depending on if there is other data in the cell other than facebook/google:
=COUNTIF({Social Media Data 2021 Range 8}, "facebook"
-
That's it! It worked! Thank you so much for your help.
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.5K Get Help
- 424 Global Discussions
- 136 Industry Talk
- 465 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 145 Just for fun
- 62 Community Job Board
- 465 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 301 Events
- 39 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!