Cell count by multiple conditions

sharpeye

Board Regular
Joined
Oct 5, 2018
Messages
51
Office Version
  1. 2019
Platform
  1. Windows
Hello everyone
I need a little help. Im tring to do a count of cells based on colours. The first colour is the font which, if the font is yellow (based on the probability of a result being over a certain value, in this case 85%+.) when the result is positive, I colour the cell green, if not I colour the cell red. Id like to count all the cells in a given range that are both green in colour with yellow font. I already have the commands in place that can count cell colour and font colour but have no idea how to combine both in a count.

I count the font colour using
=CountCellsByFontColor(M2:M95,M1)

I count cell colour using
=CountCellsByColor(M2:M95,M1)

I would like to create a cell that would only count the cells that meet both criteria
Any ideas would be amazing
Many thanks
 
Last edited:
The way I interpreted your original post was that you were using UDFs to count the number of cells in a given range - M2:M95 - where the cells' format matched the format of another given cell - M1. The UDF I wrote in post #2, when placed in a standard module and applied to the same ranges using some sample data, works like this:

test.xlsb
MNOPQRS
11%= 'template' cell
281%46= Count of cells in M2:M95 matching 'template'
391%
473%
585%
675%
776%
895%
987%
1074%
1185%
1284%
1373%
1481%
1577%
1672%
1793%
1887%
1994%
2093%
2189%
2298%
2375%
2488%
2592%
2670%
2781%
2881%
2991%
3073%
3185%
3275%
3376%
3495%
3587%
3674%
3785%
3884%
3973%
4081%
4177%
4272%
4393%
4487%
4594%
4693%
4789%
4898%
4975%
5088%
5192%
5270%
5381%
5481%
5591%
5673%
5785%
5875%
5976%
6095%
6187%
6274%
6385%
6484%
6573%
6681%
6777%
6872%
6993%
7087%
7194%
7293%
7389%
7498%
7575%
7688%
7792%
7870%
7981%
8081%
8191%
8273%
8385%
8475%
8576%
8695%
8787%
8874%
8985%
9084%
9173%
9281%
9377%
9472%
9593%
96
Sheet3
Cell Formulas
RangeFormula
N2N2=CountAllColors(M2:M95,M1)


I'd be keen to know if you were able to try it out, or if I'd misinterpreted your original intention.
Thats perfect, works like a dream. Many many thanks
 
Upvote 0

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,216,070
Messages
6,128,615
Members
449,460
Latest member
jgharbawi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top