Count IF Cell contains text AND cell colour is ....

ktoon

New Member
Joined
Feb 5, 2015
Messages
30
Hi,

I am trying to count data from Table 1, in Table 2 - but I need to only CountIF the cell contains the specific text (FRED,GEORGE etc.) AND a specific colour as shown.

Table 1

*RED**GREEN*
1:00pmFREDGEORGE
2:00pmDAVEDAVE

<tbody>
</tbody>


Table 2
*RED**GREEN*
FRED10
GEORGE01
DAVE11

<tbody>
</tbody>


At the moment I have am using this VBA:
Code:
Function CountCcolor(range_data As Range, criteria As Range) As Long    Dim datax As Range
    Dim xcolor As Long
xcolor = criteria.Interior.ColorIndex
For Each datax In range_data
    If datax.Interior.ColorIndex = xcolor Then
        CountCcolor = CountCcolor + 1
    End If
Next datax
End Function

With this formula:
Code:
=CountCcolor(DeliveryLog!$B$3:$F$17,Data!$B$1)

But I have not idea how to use this with COUNTIF(S) or anything because you have to choose range and criteria separately.

Any ideas anyone?

(Excel 2010)

Thanks
Kyle
 

Some videos you may like

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Watch MrExcel Video

Forum statistics

Threads
1,122,577
Messages
5,596,996
Members
414,116
Latest member
sfullnet

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
Top