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.9K Get Help
- 441 Global Discussions
- 139 Industry Talk
- 471 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 496 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!