count common cell entries within 2 ranges

jammoca

Banned
Joined
Nov 6, 2002
Messages
1,100
I have dates within range F7:BB7.

I have another range that also have dates as entries ... BW10:DO10

I'd like to have a formula that couns how many cells within those 2 ranges share a common date entry.

I'm assuming it will be a countif formula, but can't seem to figure it through.

Kind regards

Chris
 

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

mirabeau

Banned user
Joined
Nov 4, 2010
Messages
2,075
I have dates within range F7:BB7.

I have another range that also have dates as entries ... BW10:DO10

I'd like to have a formula that couns how many cells within those 2 ranges share a common date entry.

I'm assuming it will be a countif formula, but can't seem to figure it through.

Kind regards

Chris
Chris,

Not a formula as you requested, but, if only for interest
Code:
Sub in_common()
Dim b(50000) As Byte
Dim rng1, rng2, c, k As Long

rng1 = Range("F7:BB7")
rng2 = Range("BW10:DO10")

For Each c In rng1
    If Len(c) > 0 Then b(c) = 1
Next c

For Each c In rng2
    If b(c) = 1 Then b(c) = 2
Next c

For Each c In rng1
    If b(c) = 2 Then k = k + 1
Next c

MsgBox k & " dates in common"

End Sub
Also, to clarify.
If you have 2 dates the same in the first range and one date equal to these in the second range, do you count this as 3 cells sharing the same date, or only 2?
 

Watch MrExcel Video

Forum statistics

Threads
1,122,597
Messages
5,597,091
Members
414,122
Latest member
eazyyexcel

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