How To Count Cells in A Range With A Value Less Than Another Cell in Excel - Stack Overflow
How To Count Cells in A Range With A Value Less Than Another Cell in Excel - Stack Overflow
- Stack Overflow
How to count cells in a range with a value less than another cell in excel?
Asked 6 years, 11 months ago Active 6 years, 11 months ago Viewed 12k times
if "team1" value is less than "general" value in that month, then it has blue color, if "team2" value is less than "general" value in that
month, then it has pink color,
Now I want to count how many blue colored and how many pink colored cells on each row in a year (cells AK3 and AL3)
Your image attachment is not readable. – Youbaraj Sharma Dec 10 '13 at 8:32
Were you able to open that link? – alwbtc Dec 10 '13 at 8:34
Yep but the image is too small, and not able to download it also – Youbaraj Sharma Dec 10 '13 at 8:39
After opening the link, you can click on the image, so that the image will be zoomed in. – alwbtc Dec 10 '13 at 8:46
https://stackoverflow.com/questions/20489472/how-to-count-cells-in-a-range-with-a-value-less-than-another-cell-in-excel/20491479#20491479 1/6
27/11/2020 How to count cells in a range with a value less than another cell in excel? - Stack Overflow
1 This formula will do what you are looking for, assuming you move everything one column to the right (adding an empty column in
column A):
What this does is that it first looks if you have Team1 in the column. It then proceeds to check if the data below is less than the one
preceding that. It is important you have the last if as A and the others as B because otherwise it will summarise the wrong data. (For
team2 you will have to change the last B3:AJ3 to A3:AI3)
Also, use shift+enter when you enter this to make sure it becomes an array formula.
I would highly recommend you switch your columns and rows to a more standardised form first in order to have an easier workflow
I would then recommend you check out the answer for a similar question here. To summarise, you gather the data in one column and
then use a
https://stackoverflow.com/questions/20489472/how-to-count-cells-in-a-range-with-a-value-less-than-another-cell-in-excel/20491479#20491479 2/6
27/11/2020 How to count cells in a range with a value less than another cell in excel? - Stack Overflow
I cannot switch the columns and rows, I have to preserve the table structure as it is. Isn't there a way? – alwbtc Dec 10 '13 at 9:00
I just figured one out :) I will add a new answer – MagneTism Dec 10 '13 at 9:07
Better form to combine your two answers into one post. – brettdj Dec 10 '13 at 9:20
2 Changed to having both of the answers in one post, hope this helps! – MagneTism Dec 10 '13 at 9:34
You can use XL4 macros (Excel formula) to count up cells with different backcolor or even font colour in excel :) See this LINK. For
Font color the type_num is 24 . And for backcolor we will use 63
9
1. Open the Name Manager
2. Give a name. Say BackColor
By using our site, you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service.
https://stackoverflow.com/questions/20489472/how-to-count-cells-in-a-range-with-a-value-less-than-another-cell-in-excel/20491479#20491479 3/6
27/11/2020 How to count cells in a range with a value less than another cell in excel? - Stack Overflow
https://stackoverflow.com/questions/20489472/how-to-count-cells-in-a-range-with-a-value-less-than-another-cell-in-excel/20491479#20491479 4/6
27/11/2020 How to count cells in a range with a value less than another cell in excel? - Stack Overflow
=backcolor
Next put =COUNTIF(A2:J2,8) and =COUNTIF(A2:J2,7) in cell C5 and C6 respectively and you will get the total count of colors.
https://stackoverflow.com/questions/20489472/how-to-count-cells-in-a-range-with-a-value-less-than-another-cell-in-excel/20491479#20491479 5/6
27/11/2020 How to count cells in a range with a value less than another cell in excel? - Stack Overflow
Try this:
=IF(B2="Team1",IF(B3<A3,1,0),IF(B2="Team2",IF(B3<OFFSET(A3,0,-1),1,0),""))
=COUNTIFS($A$2:$AJ$2,"Team1",$A$4:$AJ$4,1)
=COUNTIFS($A$2:$AJ$2,"Team2",$A$4:$AJ$4,1)
Excel cannot count colors Are you sure? :) – Siddharth Rout Dec 10 '13 at 9:30
@SiddharthRout i mean using built in formula. LOL. he doesn't want VBA. But if there is a built in function that can do, please enlighten me. :) – L42
Dec 10 '13 at 9:33
Yes I meant using formulas. You can use XL4 macros (Excel formula) to count up cells with different backcolor or even font colour in excel :) See
this LINK. For Font color it is 24 . However I don't remember the value for backcolor . It sure can be found using Google :) – Siddharth Rout Dec
10 '13 at 9:36
@SiddharthRout that's why i said enlighten us. :) LOL i already edited my answer hahaha. – L42 Dec 10 '13 at 9:41
By using our site, you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service.
https://stackoverflow.com/questions/20489472/how-to-count-cells-in-a-range-with-a-value-less-than-another-cell-in-excel/20491479#20491479 6/6