VBA Make formula into a Function for Pairs

Stephen_IV

Well-known Member
Joined
Mar 17, 2003
Messages
1,180
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Good afternoon,

I am looking for some help with VBA code that will make a function for Matched Scores (Pairs). Column A is a pre test and Column B is a Post test. I would like to count how many matched scores there are in A1:B15 ( there are 11) . I am looking to use this as an add-in function.

Thanks in advance Stephen

Book1
ABCDEFG
1237911
2323
34276
44368
53
6368
74665
846
95645
105756
117657
12644
1343
148735
152
Sheet1
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
How about ...

Code:
Function MatchedPairs(r1 As Range, r2 As Range) As Long
    MatchedPairs = Evaluate("sumproduct(isnumber(" & r1.Address & ")*isnumber(" & r2.Address & "))")
End Function
 
Upvote 0
Thanks shg that will work just wondering if there is another way to do it without the Evaluate Sumproduct approach? Just trying to learn. Thanks in advance.
 
Upvote 0
There are many stories in the Naked City. This is just one.
 
Upvote 0

Forum statistics

Threads
1,224,566
Messages
6,179,558
Members
452,928
Latest member
101blockchains

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