Insert Value "Number of cells with color filling" at the beginning of each row in the table

apor

New Member
Joined
Dec 20, 2021
Messages
25
Office Version
  1. 2016
Platform
  1. Windows
Hello everyone,

I have a worksheet containing rows of data. cells in each row that meet a certain condition are highlighted yellow. Now i want to insert a cell at the beginning of the table with a number containing the number of cells that are highlighted yellow.

the conditional formatting string for the filling is as follows:

=AND(C2="",SUM($C2:C2)>0,SUM(C2:$CC2)>0)

i added the results i would like in column B as an Image

1686916063384.png

t
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Try placing the following formula in cell B2 and drag-copying it down as needed:
Excel Formula:
=SUMPRODUCT(--(C2:CC2=""),SIGN(COUNTIF(OFFSET(C2,,,,COLUMN(C2:CC2)-COLUMN(C2)+1),">0")),SIGN(COUNTIF(OFFSET(CC2,,,,COLUMN(C2:CC2)-COLUMN(CC2)-1),">0")))
 
Upvote 0
A couple more (non-volatile) options to consider. With your version I think that the column B formula would need to be confirmed with Ctrl+Shift+Enter, not just Enter, but the slightly longer column A formula I think could be entered normally with just Enter.

23 06 17.xlsm
ABCDEFGHIJK
1
2331111
311111121
4111221
5001111
633111
722111
800111111
Count yellow
Cell Formulas
RangeFormula
A2:A8A2=LOOKUP(9^9,C2:CC2,COLUMN(C2:CC2)-COLUMN(C2)+1)-MATCH(TRUE,INDEX(C2:CC2<>"",0),0)+1-COUNT(C2:CC2)
B2:B8B2=LOOKUP(9^9,C2:CC2,COLUMN(C2:CC2)-COLUMN(C2)+1)-MATCH(TRUE,C2:CC2<>"",0)+1-COUNT(C2:CC2)
Press CTRL+SHIFT+ENTER to enter array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C2:M8Expression=AND(C2="",SUM($C2:C2)>0,SUM(C2:$CC2)>0)textNO


If it is possible that you could have rows with no numbers at all then the formulas would need to be modified like this
=IFNA(LOOKUP(9^9,C2:CC2,COLUMN(C2:CC2)-COLUMN(C2)+1)-MATCH(TRUE,C2:CC2<>"",0)+1-COUNT(C2:CC2),0)
 
Upvote 0

Forum statistics

Threads
1,215,086
Messages
6,123,040
Members
449,092
Latest member
ikke

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