We continue exploring the possibilities of Google Spreadsheets with COUNTIF function. Learn why you may need it and how it can be applied to your daily work with the tables. Continue reading
by Alexander Trifuntov, updated on
We continue exploring the possibilities of Google Spreadsheets with COUNTIF function. Learn why you may need it and how it can be applied to your daily work with the tables. Continue reading
Comments page 5. Total comments: 393
Hi! Can you help in writing a countif function where the cell does not contain "---"
Hi Abraham,
If I understand you correctly, this formula will do the trick:
=COUNTIF(A2:A10,"<>*---*"
I wonder whether the following is possible.
In TAB1, column A has a number of people's names. Column B onwards is then made up of dates and each column records attendance the attendance of the names in column A
In TAB2, column A has the same names. I want Column B to then repeat whatever is in the cell of today's column in TAB1, so if H1 has today's date, then it will give me the attendance of the named person (in A9) in B9 in TAB2.
How do I get column B in Tab2 to pick up the relevant cell from today's column? Is there an appropriate formula?
Thanks in advance for anyone who is able to help!
Hello Jon,
If I understand you correctly, you can try to use IF along with the VLOOKUP function.
In case you're not sure how to use them exactly, please share a small sample spreadsheet with us (support@apps4gs.com) with your sheets and the example you want to get (the result sheet is of great importance and often gives us a better understanding than any text description). I kindly ask you to shorten the tables to 10-20 rows.
Note. We keep that Google account for file sharing only, please do not email there. Once you share the file, just confirm by replying to this comment.
I'll look into your task and do my best to help.
I was wondering given your example sheet above.
If I want to count the amount of Dark Chocolate sold fx.
so sum up all numbers in column total sales where column Product = "Dark Chocolate"
Figured it out ..
=SUMIF(A2:A500,D1,C2:C500)
Where content of D1 would be the value to look for
Hello Peter,
You're right, it's SUMIF that totals numbers. We have a separate blog post devoted to SUMIF, feel free to take a look.
Thank you for monitoring this channel and helping us out.
How can I use COUNTIFS and OR
=COUNTIFS(E35:T35, "Z" OR COUNTIFS(E35:T35, "1" )
Thank you for the feedback, Walter.
You'll find an answer to your question in this part of the blog post: Count in Google Sheets with multiple criteria – OR logic
Hi I want to count only if two criteria are met.
EG Cells in Range A14:A35 = A and Cells in range C:14:C35 = W
I only want a count of 1 if both conditions are met
Thanks
James
Hi James,
You will find examples of how to count by multiple criteria in this part of the blog post.
Hi there,
I was wondering if there was a way to count if one cell is greater than another range. For example I have a set of scores for students in P column (say range P3:P80) and a second set of score in Q column (Q3:Q80). I want to count the scores in Q column IF they are greater than the initial scores, e.g. I want to count the number of students who got a higher score in the second set of results.
Cheers,
Emma
Hi Emma,
Here's a formula for you to try:
=SUMPRODUCT(--(Q3:Q80>P3:P80))
Hi,
I have this Array Formula in my Google sheet:
={{unique(ArrayFormula(text(K4:K2001,"MMMM")))},
{ArrayFormula(sumif(ArrayFormula(text($K$4:$K$2001,"MMMM")),
unique(ArrayFormula(text(K4:K2001,"MMMM"))),$I$4:$I$2001))}}
The dates it is counting starts from August 2020 through to April 2021.
My problem is for any dates not completed in any given month, it is counted in December, this giving an incorrect count.
Any idea how to fix this?
Hi Colin,
We tried to recreate the formula on our side and it works correctly. Please go to File > Spreadsheet settings and specify what locale you have selected there. Also, provide a couple of examples of your dates in cells.
I have a COUNTIF formula but after the count I want it to divide the count by 2
=COUNTIF(E9:E755,"Couple")
How do I add to the formula above to then divide the count by 2?
Hello Marnee,
Here you go:
=COUNTIF(E9:E755,"Couple")/2
Hi,
Workbook 1, Sheet "ABCSCHOOL" itemizes a constantly changing number of students per section, per grade.
Workbook 2, Sheet "ABCSTAFF" totals the numbers of students per section for all grades, in order to determine the amount of staff needed per section for the coming year.
ABCSTAFF currently has cells that contain the current formula:
=IMPORTRANGE("https://docs.google.com/spreadsheets/d/WORKBOOK1","ABCSCHOOL!E90")
I am using the COUNTIF function in ABCSTAFF to count the number of cells that have a number greater than 0. I am not trying to obtain the sum of the numbers in the cells, but rather the number of cells that contain a number. That formula looks like this: =countif(D4:D10,">0")
What I am trying to figure out is:
1. Is there a formula I can use to count a cell twice if the number in it is greater than 8? For example, Assuming range D4:D10 has 3 cells containing numbers 2, 4 and 5 and another cell containing the number 12, I would like the total count to equal 5 cells, as opposed to 4.
2. How would I add that additional formula to the cell that already contains =IMPORTRANGE("https://docs.google.com/spreadsheets/d/WORKBOOK1","ABCSCHOOL!E90")
Thank you.
Hello Denise,
I'm sorry but your task is quite confusing. I just don't see why the count should return 5 if only 1 number is greater than 8, so I'm not sure what to add to the formula. I also don't understand what the cell with the importrange and the count should contain as a result.
For me to be able to help you, please share a small sample spreadsheet with us (support@apps4gs.com) with 3 sheets: (1-2) a shortened copy of your source data (3) the result you expect to get. I kindly ask you to shorten the tables to 10-20 rows. If you have confidential information there, you can replace it with some irrelevant data, just keep the format.
Once you share the file, please reply to this message. I'll look into your task and try to help.
Thank you Natalia.
I shared two workbooks with you (they were sent under a different email address). I greatly appreciate any help you can provide!
Hi Denise,
Thank you for sharing the files. I entered the correct formulas right under your current ones – in row #13 – and colored cells green. Hope this will help :)
Thank you! This is exactly what I was looking to do. You are amazing!
You're most welcome, Denise! :)
Is there a way to conditionally average values? Say there are text values in column A. If cell is not blank in the row I want to know the value of cell B divided by cell C. And then find the average.
Would this be:
`=AVERAGE(if(A1:A100,B1:B100/C1:C100,null))`
Hi David,
I believe the following formula would work better:
=ARRAYFORMULA(IF(A1:A100<>"",AVERAGE(B1:B100/C1:C100)))
We have an entire blog post devoted to the IF function, feel free to take a look.
Thanks! It works!
Hi, I need help with Google sheets conditional formatting and formulas. I want to know how to highlight rows in Tab 1 with matching specific and partial keywords from Tab 2? And I need to know how to get the total amount of the highlighted rows in Tab 1, Column G. Please see this sample workbook: https://drive.google.com/file/d/1LtZqlrrBoiDbmSZm-5eA26QXngKsIS0w/view?usp=sharing
I hope you can help me. Thank you.
Hi,
We have a special blog post devoted to conditional formatting in Google Sheets: it describes how to format cells by the text they contain, how to format entire rows and how to create conditional formatting based on another cell.
Also, there are no standard Google Sheets functions that process only highlighted cells. For such purposes, we have a special add-on – Function by Color. It calculates data based on the font or/and fill color. There's a fully-functional 30-day trial period available so you could try it out and see if if suits your needs. You will find the detailed instructions on how to work with the add-on on its help page.
I have two columns of data and I need a to count the number of rows where column A is greater than column B. Can I do that with countif?
Hello Ivan,
try the following formula instead:
=SUMPRODUCT(--(A2:A100>B2:B100))
hello,
I am trying to use this code,,,, but to cell A21 then A22 and so on,,,, please how to that
with this code i am using entire A column as a range
If Application.CountIf(Sheets("Sheet1").[A:A], Sheets("Sheet2").Cells(RowNum, "A")) = 0 Then
Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Offset(1).Value = Sheets("Sheet2").Cells(RowNum, "A").Value
Hello Reda,
It looks like these are parts of the VBA code for Excel while this blog post is about Google Sheets.
Anyway, we don't help with macros so, for Excel users, my best advice would be to try and look for the solution in VBA sections on mrexcel.com or excelforum.com
Hi Natalia,
So it is a long record of incidents in which the time is recorded, I want to create a line graph for month by the most common time for example 14:00-14:59 and 15:00-15:59.
My formula is based on all the times for that month (January) on a separate tab, I am then trying to put a formula as follows (using the examples above). >=14:00 but =C107",
'Claims Log'!K2354:K2455,"<D107")
Thanks
Hi Brian,
Thank you for the description.
I'm afraid I will need to look into your data since this time you introduced another criteria '=C107' and didn't specify what lies in D107.
Please share an editable copy of your spreadsheet with us (support@apps4gs.com) with 2 sheets: 1) a copy of your source data with a formula, 2) the result you expect to get.
Note. We keep that Google account for file sharing only, please do not email there. Once you share the file, just confirm by replying here.
Thank you.
If I have loads of times how can I count up per hour
=countif('Claims Log'!K2354:K2455,"D107")
This is the formula I tried, greater than 00:00 but less than 01:00
Sorry, this is what I tried
=countif('Claims Log'!K2354:K2455,"D107")
Hello Brian,
For me to be able to help you, please describe your task in detail:
If you provide examples of a few records you have and what you're trying to achieve, it'll help a lot.
Hi, want to know the formula . If a student scores 7/7 , then he will be graded A+, if student scores 6/7, then he will get A. Like this. Please help
Hi Rajashri,
In cases when you have several different outcomes depending on various conditions, you'd better use the IF function for the task.
Hello.
If a Cell is "YES", then these cells will be added together. If "NO" or empty cell, then do not add. Here is what I have.
=COUNTIFS(Y10:Y11,"YES")+COUNTIFS(AND(B2="BRAND",B3="Shirt"),ArrayFormula(SUM(COUNTIFS(I10:J293,{"X","Y","Z"}))))
Thank you in advance.
Hello Tony,
I believe the IF function will do better for your task. Please look through the following blog post to learn how it works: IF function for Google Sheets
Hello,
Very much appreciate this forum, and the help. G Suite is new to me, especially Sheets. This should be a simple one:
Column B has a list customer names:
company a
company a
company b
company c
company a
company d
company e, etc.
Here's what I'm trying to accomplish:
1. This list is ongoing, it doesn't start in B2 and end in B10 for example, this is a running list. B1 is the title of this column, though.
2. I want to know how many projects we do, via a percentage pie chart, for company a, company b, company c, etc. The pie chart would ultimately show 50% company a, 20% company b, and so on.
3. The formula and chart should allow for new customers to be added; there could be a company f, company g, company h, infinitely.
Any help would be greatly appreciated!
Hello!
To automatically add new customers to the chart, you can specify a very large data range for the chart. For example, your data is in B1: C10 and the range for the chart is B1: C100. Blank cells are not used in the chart. As soon as you write data into B11 and C11, it will automatically be shown in the chart.
Thanks Alexander. But I still don't know how to do the formula correctly, nor do I know how to do the pie chart correctly either.
Hi Jeremy,
Alexander described how to create a pie chart in this blog post.
There's no need to create a formula. When creating charts, you refer to the existing tables and adjust the chart settings. Please follow the provided link for details about charts.
Hello
I am trying to do two things:
1. Count data from a different google sheet and populate it in my data sheet. I did the Countif(importrange("html or url key", "sheet and column"), "input")
It returns a 0 although the column has 215 input. I also tried copying the data into a newly created sheet to avoid authority issues. Still not working
2. On a single row i can have 7 entries. Users can enter any of 5 choices from the drop down. At the end of the day i need to count the occurrences of each entry and populate the last cell on the row with the most occurring value. Example
1 2 3 4 5 6 7 Majority
red blue yellow yellow red yellow white yellow
Here the last cell should populate as Yellow as it occurred the most
I tried creating another set of tables at the bottom with just the count of the colors. I am missing the logic that says take the highest count and return the value of that entry. So i want a logic that realize yellow is highest count and it should populate the word yellow as a result. And then I am just referencing that Majority cell back to the original location at the top of the sheet. Example
Red Blue Yellow White Majority
2 1 3 1 Yellow
Hello!
To find the most common value in a string, use the array formula:
=ARRAY_CONSTRAIN(ARRAYFORMULA(INDEX($A$2:$S$2,, MATCH(MAX(COUNTIF($A$2:$S$2,$A$2:$S$2)), COUNTIF($A$2:$S$2,$A$2:$S$2),0))), 1, 1)
I hope it’ll be helpful.
I am sharing the spreadsheet. So different people populate the data. Some sections are divided into 2 and some are not. I need Column L to populate automatically depending on the entries. How do you handle instances where 2 values are entered equally? Or if you have one Fully (100%) and Two (75%) and a three (less than 50%). In this case I want it to default to somewhat. Can I change the text values to percentages so it can calculate the average and give me a text value back?
https://docs.google.com/spreadsheets/d/1ItaYhyXifEXAn2jQNh-gHwgOr6gEBbZCfP9Mnk6eU0o/edit?usp=sharing
Hello!
If two values are entered the same number of times, the one at the beginning of the list will be shown.
If cells in a row are merged, this does not affect the calculations.
To calculate the percentage of occurrence of the most frequent value, you can use the formula
=countif(B3:K3,L3)/counta(B3:K3)
or
=countif(B3:K3,ARRAY_CONSTRAIN(ARRAYFORMULA(INDEX($B$3:$K$3,, MATCH(MAX(COUNTIF($B$3:$K$3,$B$3:$K$3)), COUNTIF($B$3:$K$3,$B$3:$K$3),0))), 1, 1)) / counta(B3:K3)
Hope this is what you need.
Thank you, this helped alot. I still need help with the following
1. Count data from a different google sheet and populate it in my data sheet. I did the Countif(importrange("html or url key", "sheet and column"), "input")
It returns a 0 although the column has 215 input. I also tried copying the data into a newly created sheet to avoid authority issues. Still not working
Or just copy the data as it is entered into another sheet. Not tab, a new sheet
I feel I am missing something in my code. perhaps you can help! My intention is that when 2 criteria (column n which holds a tag type and Column m that holds a tag number) both have duplicates it would change the color on column n on the duplicates. I have done this before with one column =countif(B:B,B1)>1 and that works, but trying to do 2 columns it's not working. what am i missing? Two codes below are ones I have used to try to get to work.
=((countif(N:N,N1)>1)+(countif(M:M,M1)>1))
=COUNTifS($N$2:$N, ">1",$M$2:$M ,">1")
Hello April,
If you're trying to color complete row duplicates, a formula like this should help you:
=COUNTIFS($M$2:$M;M2;$N$2:$N;N2)>1
Hi,
We're using sheets as a weekly time table for project work management. We write down which project we worked on at what time. I'm trying to summarise the amount of time worked on each project at the end of the month.
we have 2 products that use the same project names, with the product acronym ahead of the project name (IE-AB Cars\CD Cars).
Each sheet represents a week.
Using =COUNTIFS('2-8.8.2020'!A3:G22,"*AB*",'2-8.8.2020'!A3:G22,"*Cars*")
This works fine when I refer to one sheet\week at a time. but trying to add all sheets\weeks doesn't work
thanks
Hi Eli,
Could you please let us know what your formula returns exactly when it doesn't work? Is it '0' or some specific error?
Hi Natalia,
It returns'0'
Thank you for replying, Eli.
Since COUNTIFS "returns the count of a range depending on multiple criteria", '0' usually means that there are no records matching all your criteria.
However, if you see matches without the formula and are sure the result should be different, please share an editable copy of your file along with the formula that doesn't work with us (support@apps4gs.com).
Note. We keep that Google account for file sharing only, please do not email there. Once you share the file, just confirm by replying to this comment. We'll look into it and see what may be going wrong.
I need some help.
I have a calender with an allocation of 2HC per day to go on leave
I would like the first 2 names that are input in the day to be left in its original format but with every additional names added into the particular date range will be highlighted.
I'm currently using =countif($F$8:$F$11,"*")>2 but this will highlight every column in my range for as long as the input is more than 2.
Is there any way to go about highlighting only the names that comes after the 2nd entry?
Thanks ^^
Hello Farah,
Please consider sharing an editable copy of your spreadsheet with us (support@apps4gs.com) with 2 sheets: 1) a small example of your source data with the rule you're trying to apply 2) and the result you expect to get. I kindly ask you to shorten the tables to 10-20 rows.
Note. We keep that Google account for file sharing only, please do not email there. Once you share the file, just confirm by replying here.
Thank you.
can we count how many operators does a cell have in spreadsheet
Hello Jacob,
For us to be able to suggest anything, please describe your task in detail.
Little help? countifs two arguments don't work for me
Hello Alek,
We describe how to count by multiple criteria in this part of the blog post.
If your formula still doesn't work, please provide it here so we could see how it looks.
Good afternoon, I have a question.
I have several texts in different cells. The texts are similar. How do I know if they are the same? And if they are not the same, how do I know what percentage of words are repeated? And based on that percentage, can I declare a color range?
Then, I need to import from one sheet to another according to that percentage. If the percentage is high, it is not copied, if it is low, it is copied.
thank you... ♥
Good afternoon, Martin,
I'm afraid your task is rather complex so I can't suggest anything in particular. However, you can share a small sample spreadsheet with us (support@apps4gs.com) with 2 sheets: a copy of your source data and the result you expect to get. I kindly ask you to shorten the tables to 10-20 rows.
Note. We keep that Google account for file sharing only, please do not email there. Once you share the file, just confirm by replying here. We'll look into your task and see if we can help.
Sheet 1
Col A1 58+1 BOXN
A2 42+1 BCN
A3 57+1 BCNHL
A4 58+1 BOXNHL
Sheet2
Col A1=( Count of BOX/BOXNHL)[=2]
Col B1=(count of BCN/BCNHL)[=2]
HOW TO WRITE FORMULA
Hello Mahesh,
We described how to count cells that contain certain text in the following part of the blog post: Google Spreadsheet COUNTIF function and wildcard characters (partial match)
Your formulas may look like this:
=COUNTIF(Sheet1!A:A,"*BOX*") for A1 and =COUNTIF(Sheet1!A:A,"*BCN*") for B1
Is it possible to use countif with ValuesbyColor. IE I'd want to know how many times "John" appears in either red or blue cells
Hello Tomi,
Yes, you can use the valuesByColor formula in the COUNTIF. However, one formula can process only one color at a time, so COUNTIFS won't work here. Please do the following:
=COUNTIF(valuesByColor("#f4cccc", "#000000", Sheet1!A1:A10),"John")
Thanks that worked! I also have a follow up, does it work with sumif?
I've tried
=SUMIF(valuesByColor("#e06666", "#000000",Sheet1!$B$2:$B$999"*John*",Sheet1!$D$2:$D$1000))
The second range ($D$2:$D$1000) counts time so it should create how long time John has accumulated in all the cells with that color. But the error it gives me that there is only 1 argument
Tomi,
The SUMIF function requires different arguments, so placing them in the same order as for COUNTIF won't work. Also, in your formula, you put the condition for John and the range with time inside the valuesByColor, this also shouldn't happen.
If I understand it correctly and you need to sum times based on two conditions: 1) if there's 'John' and 2) if a cell is coloured specifically, it is SUMIFS that you need (sum on multiple criteria). But at the moment valuesByColor doesn't work within SUMIFS and COUNTIFS.
Thank you all for this content. I have one column of data where each cell is assigned a number between 1 and 13. I'm trying to find how to know the probability that any one number follows another. For example, what is the probability that a 7 is followed by another 7. Or what is the probability of the sequence 4, 9, 13. If anyone can help with this formula I would be more than grateful.
Hi Mike,
I'm afraid this task is rather complex and can't be solved with one simple formula. I'd advise you to look through these tutorial videos provided by the Google for Education service:
Calculate Probability with Google Sheets
I need help for Google sheets formula.
if the percentage value of F4 > C4 = "good"
if the percentage value of F4 < C4 = "bad"
if the percentage value of F4 = C4 = "same"
Hello Regielyn,
The IF function will help you with this task, please read about it in this blog post.
Hi,
I have an 'attendance' list each week. I have names indicated by row, and dates indicated by column. I mark present with an 'x'. I would like to select each week (5 days so 5 columns) for a group of students (31 students, so 31 rows) and see if they showed up at least once that week. I do not want to count if they were there multiple days, but just know how many students out of the 31 showed up at least once that week. Is there a formula for this?
Hi Kelsey,
You can create additional columns right at the end of each week and use the formula like this for each student:
=IF(COUNTA($B2:$F2)>0,"attended","absent")
Please refer to these articles explaining how these functions work:
IF function
COUNTA function
How to count the Quantity of Milk Chocolates ?
Hello Fazlan,
the SUMIF function will sum numbers related to a certain text. Please check this tutorial to learn how to use SUMIF: SUMIF in Google Sheets.
Hello!
I need to count "No" values of users on a column, but this count needs to be conditioned by this:
If the "No" value is already on another row of the same column and belongs to the same user (this can be checked because I'm using one app ID on a specific column), then don't count it.
How can I filter that with formulas?
Hello Hebert,
If I get it right, the quickest and easiest way is to use our Remove Duplicate Rows add-on to find all unique rows and mark them in a status column.
Then use COUNTIFS to count those rows that have "No" as the answer and that are Unique:
=COUNTIFS(B2:B10,"No",C2:C10,"Unique")
Hi,
I've been trying out the different formulas that seem to apply to my sheet, but it's weird, because the formula works, but the result is wrong. I have column F, which lists down the names of several people repeatedly.
Once someone completes a task in the list, they are to change the cell's background color to Shamrock Green (hex code is #0F9D58).
In a separate sheet for a summary, I have a column that serves to count the total number of tasks that they have completed (marked by the background color). I've been testing it out by coloring the cell accordingly, but the value that is returned is 0.
=COUNTIFS(F:F,valuesByColor("#0F9D58","#000000",TASKLIST!F:F),F:F,"NAME")
This formula, which I've learned about from your other article, works fine by itself! But I need to countif the name of the person when the cell has been colored Shamrock Green.
=COUNTA(valuesByColor("#0F9D58","#000000",TASKLIST!F:F))
Would appreciate any help! Thanks.
Hi Pocholo,
I'm happy to let you know that we released new versions of our Function by Color and Power Tools add-ons that include two new functions that can be used in COUNTIFS/SUMIFS in order to process cells based on colors & contents.
You will find all the necessary info about these functions in this tutorial.
Sorry, here's the formula that I've been trying to use:
=COUNTIFS(TASKLIST!F:F,valuesByColor("#0F9D58","#000000",TASKLIST!F:F),TASKLIST!F:F,"NAME")
Hi Pocholo,
Unfortunately, since our valuesByColor returns values from cells, it cannot be wrapped in another condition for another column. We'll consider improving the formula in the future if it's technically possible.
For now, I can only offer to try and use Scripts. Here's an overview of Google Apps Script with a lot of helpful content and links:
https://developers.google.com/apps-script/overview
Hi Natalia,
Got that! Appreciate the response -- just wanted to confirm as well, whether my formula was constructed correctly, or was it even supported by the function, since there is no error message and the cell just returns a 0 value.
Thank you, and more power to your blog! They're quite informative and very helpful when troubleshooting and navigating the nuances between Google Sheets and Excel. :)
Thank you, Pocholo! :)
I am copying some formulas from Excel over to Sheets and one of them just isn't translating.
=SUM(COUNTIFS(A21:A93, {"*Contacted*","*Intro*","*Webinar*","*Disclosed*","*Application*","*Territory*"}, B21:B93, "*Business Professional*"))
The answer should be 16
But when entering the same formula into Google, it returns 4.
I was trying to find out if the syntax is just different in Google Sheets but so far haven't figured it out.
I'm guessing it's in the multi criteria between the "{" brackets... but... can't figure it out.
Thanks
Looks like all I needed was to add
ArrayFormula(
To the front of it
Hello E,
Glad to hear ARRAYFORMULA did the trick! :)
Hi Guys..
I hope you all doing fine…
I have problem ..
In google sheet,
I want to sum (range of number) if the criteria is matches the formula below.
I have multiple ranges and criteria .
And one of the ranges I need to add 2 criteria .
so for example :
I need to calculate the salary for the employees
If the employee (( city) (The range)) is from ((city 1 or city 2)(multiple criterias ))
And other ranges also like ( showroom, age and profession etc) .
Thank you in advance ..
Hi Osama,
We covered how to sum in Google Sheets based on multiple criteria in this blog post, feel free to have a look :)
I try to find the number of cells with a value greater than 30 but it gives me an error. This is the formula I use. Do you know what I’m doing wrong?
=countif(c259:c261,”>30”)
Thanks
Hello Ryan,
Try using straight quotes instead of smart ones for the condition:
=COUNTIF(C259:C261,">30")
I'm using your formula, but changing the inputs. I'm using a QUERY instead of just a fixed range. For some reason, I have a number of values that result in an empty cell. If I remove the ,) at the end of the IF-formula, I have a number of cells that output FALSE.
Is there a way to get rid of those?
Hello Juul,
For us to be able to suggest anything, please provide your formula so we could see what you enter exactly.
Hi,
I have a range of data that contains dollar amounts and I am trying to find any amount that is greater than or equal to $5 and color coordinate it based on how many times it appears in the data set. For example the first time a cell contains data greater than or equal to $5, it would be color coded as green, the second time it happens, it would be color coded as yellow, etc.
Can you help with that?
Thanks!
Hi Nicole,
You should put COUNTIF into the IF formula and use both in the conditional formatting.
For example, (assuming your data starts in A2) this is the formula for conditional formatting that will colour the first occurrence of the value that is >=5 in green:
=(IF(A1>=5,COUNTIF($A$2:A2,">=5"),""))=1
To colour the second occurrence, create another rule with another colour and change 1 to 2:
=(IF(A1>=5,COUNTIF($A$2:A2,">=5"),""))=2
And so on.
Hope this helps! :)
I have a spreadsheet where i need a formula to count for a certain value in column B, but if that value is counted, it needs to reflect a number in column S. So if B4 meets the criteria, I need the value of H4 to appear.
Thank you in advance for any help
Excuse me, the H4 in the phrase "I need the value of H4 to appear" should be replaced with S4 to match my earlier example.
Thank you.
Another clarification, this spreadsheet is on google sheets.
Thank you
Hi Parker,
I believe it's VLOOKUP you should use, not COUNTIF. VLOOKUP searches the info in one column and pulls related data from other columns.
Svetlana explained everything about VLOOKUP in a special tutorial, please have a look:
https://www.ablebits.com/office-addins-blog/vlookup-google-sheets-example/
Hello,
I used the formula =COUNTIF(M3, "*(Pme)*" to tally the number of times that a specific cell contains a coding tag. However, the formula is treating 0/1 as No/Yes instead of giving me a total. Can I adjust the formula to count the number of times the coding tag appears instead?
For example, I have cell M3 which contains the sentence "Also, I (S) know (Pme) plenty of straight guys (Ph) who (S) are attracted (Pme) to more masculine women (Ph)". The formula above produced the number 1, but I want it to produce the number 2 because the tag (Pme) appears twice in this sentence.
Any feedback would be appreciated. Thank you!
Sorry, I forgot to close the parentheses. The formula is: =COUNTIF(M3, "*(Pme)*").
Okay, so upon further searching, I found =COUNTA and =COUNTUNIQUE, which yielded the results I wanted, but now I'm wondering the difference between the two. Thank you!
I take the previous comment back-- these functions did not necessarily fix the issue. Sorry for the multiple posts and thank you for your time!
Hello Sarah,
none of the functions you mentioned will help: they count cells that contain the word you need, not the number of words within those cells. For your task, you need to use the LEN function like this:
=(LEN(M3)-LEN(SUBSTITUTE(M3,"(Pme)","")))/LEN("(Pme)")
That fixed my spreadsheet, thank you so much for your help!
Hello,
I'm trying to find a way to use countifs based on values being split out of comma separated values, but something isn't quite clicking.
If i have:
ID
1
2
3
and then
SCORE | SELECTION
0 | 1,3
1 | 2,3
and i want to find out the total number of times that ID 3 was selected and there was a score of 0. The result should be 1.
I feel like i'm close with
=COUNTIFS(SPLIT($G$11:$G$14,","),3,$F$11:$F$14,0)
But i get told "Array arguments to COUNTIFS are of different size."
Hello Dan,
The SPLIT function won't work like this. It's supposed to separate values to multiple cells rather than extract records needed for calculations. Our tech specialist has created the following array formula that should help:
=ArrayFormula(SUM((MID($G$12:$G$13,FIND(",",$G$12:$G$13)+1,1)="3")*(LEFT($G$12:$G$13, 1)="0")))
Hello,
i use Google Sheet and i would like to calculate how many cells there are in a column of the same color, provided there is a value from another colone. COUNTIF is not good for color
example:
(A2: A100; A15; B2: B11; "Acquired")
Thanks for your help. =)
Hello Tony,
We covered counting by colours in another article, please have a look:
https://www.ablebits.com/office-addins-blog/count-colored-cells-google-sheets/
OK, thanks.
but that's not exactly what I'm trying to do.
This is not a COUNTIF but rather a COUNTIFS that I would need.
this example may be better explained.
A B C D
1 | color 1 | Acquired | Total color 1 Acquired | 2 |
2 | color 1 | Blocked | Total color 2 Acquired | 1 |
3 | color 2 | Blocked | Total color 1 Bloqued | 1 |
4 | color 2 | Acquired | Total color 2 Bloqued | 1 |
5 | color 1 | Acquired |
Tony,
Since there's no standard way of counting cells by their colours, our tool will still be useful.
If I understand your task correctly and "color 1" and "color 2" are cells with backgrounds, you can generate a formula with our Function by colour tool and then use it in your COUNTIFS, like this:
=COUNTIFS(A2:A6,valuesByColor("#d9ead3","#000000",Sheet10!A2:A6),B2:B6,"Acquired")
The part in bold was generated by our add-on.
The entire formula counts all cells in column B with a word Acquired if a cell in column A is coloured in accordance with a pattern in valuesByColor.
OK, thanks.
But I still have a little problem.
I think there is a problem with the third parameter of valueByColor "srcRange", it returns 1 whereas it should send me back 9.
I think that once he has found a good result, he does not continue the loop in the range.
sorry for the double post -_-"
I tried the method "valueByColor" without going through a COUNTIFS, and I realized that it sends me the values in the cells, but what I want to do is count the number of cells of the same color provided that the cell is acquired (color in colone A, and acquired in colone B).
ok, I just sent you the file with a copy of our conversation.
Thanks.
Thank you, Tony.
I've got your file and replied to you by email.
Tony,
It's rather difficult to tell why your formula doesn't work. Could you please share your spreadsheets with us to have a look? It's support@4-bits.com. We don't monitor its Inbox, so please confirm by replying here once you share the file. Thank you.
Hello -
I used your tip to figure out how to count non blank cells in a column on a certain sheet tab (Tab1). This formula works for that: =COUNTIF('Tab1'!Y2:Y889, "")
I wish to further filter the count by a text value in another column. I want to count the non blank cells in column Y that have the value "A" in column N. Then count the non blank cells in column Y that have the value "B" in column N. This formula doesn't work - I am not sure how to connect them. =COUNTIF('Tab1'!Y2:Y889, "") AND COUNTIF('Tab1'!N1:N930,"A") Thank you so much.
Note the characters between the double quotes in the formulas above are these - not sure why they did not display. If they don't display again in this comment, they are the less than sign and the greater than sign. Thank you again.
Hello Casey,
You need to use COUNTIFS for the task:
=COUNTIFS(Tab1!Y2:Y889,"<>",Tab1!N2:N889,"A")
Please keep in mind that the function requires ranges of the same sizes. Based on your example, you'll have to enter either rows 2:889 for both columns or 1:930.
Thank you, Natalia - I thought I might need to use IFS, but I had the syntax garbled. Thank you so much - this worked exactly as I wanted.
You're most welcome, Casey,
Glad I could help! :)
We want to count the values between certain dates (for our monthly report).
Our document is structured like this:
A column: Date (eg. 01-01-2019)
B column: Value (eg. Owned, earned or paid)
What's the correct formula to count the number of Owned between 01-01-2019 and 31-01-2019? Any help would be greatly appreciated!
Levi,
Please try this formula:
=COUNTIFS(B2:B10,"Owned",A2:A10,">="&DATE(2019,1,1),A2:A10,"<="&DATE(2019,1,31))
I have 4 tabs of information with columns of information that are in drop-down lists. I need to calculate the total number of times each of the items in the drop-down lists is selected (on a 5th tab). I've created the 5th tab and done the "COUNTIF" but it's not totaling. Instead, there's an error.
To clarify, this is on a Google Sheet.
Bill,
will you be able to share your file with us at support@4-bits.com? If so, please reply here once it's shared. We'll look at how your data is stored exactly and try to come up with a solution.
Thank you.
Hi,
Can you help me in getting a formula for a countif with cells containing duplicate texts.
Example:
R1 test
R2 test | test
when i use this; =countif(A:A,"*test*"), i only get 2; but I want to get 3 as the result.
Thanks for the help.
Hi Ralph,
If your duplicates are divided by the same "|" character, you can try this formula:
=COUNTIF(ArrayFormula(SPLIT(JOIN(" | ",A:A)," | ")),"test")
Otherwise, you can use our Split tool to divide cells with duplicates by their delimiters and then count all occurrences.
I want to know the total value of column b if column f is John column h is July
Teri,
I believe the SUMIFS function is what you need to use for the task. It will sum records of column B based on values in F and H.
What if I need a pie chart to show payment
If Chocolate Milk, Count the Total Value of all the orders.
I have a data set where the 'Chocolate Milk' has different values, but I need the formula to calculate all the column A results if 'Cholocate Milk', and take the value from another Column. :-/
Hello Jane,
To find out the total only for those cells that contain "Chocolate Milk", you need to use the SUMIF function instead. You'll find the tutorial about it on this page.
Dear Sir ,
I am having a set of data having some duplicate values in it . I wants to mark its frequency in its adjacent column except first one .
like
1
1 duplicate
1 duplicate
2
3
2 duplicate
4
5
2 duplicate
Hello Abhinav,
I'm sorry, I'm afraid there's no easy formula to do that.
You can either identify duplicates without the 1st occurrences using a formula like this:
=IF(COUNTIF($A$2:$A2, $A2)>1, "Duplicate", "")
or count duplicates by the example of this article for Excel.