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
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,214,817
Messages
6,121,720
Members
449,050
Latest member
MiguekHeka

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