Some basic help for a novice

Jimboexcel

New Member
Joined
Sep 29, 2017
Messages
20
Hi

I want to be able to calculate the number of names next to each other in each column.

In the table below Andy appears twice together in column 1 and also in column 2 for a total of 2. How to do this?

Any help appreciated.

Thanks

Jimbo




Mary AndyJillAndy
JohnAndyMaryJohn
BobJillBobJill
JillHarryHarryBob
HarryBob HarryHarry
AndyMaryAndyMary
AndyJohnJillAndy
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
It help if you update your profile to show your OS and Excel version. The best/possible solution is different from different Excel version.
 
Upvote 0
Upvote 0
If you are interested in UDF, then can use this function

VBA Code:
Function CountPair(rng As Range, str As String) As Long

For Each Column In rng.Columns
    For Each cell In Column.Cells
        If cell = cell.Offset(1, 0) And cell = str Then
            CountPair = CountPair + 1
        End If
    Next
Next

End Function

Usage

Andy.xlsx
ABCDEF
1MaryAndyJillAndy
2JohnAndyMaryJohn
3BobJillBobJill
4JillHarryHarryBob
5HarryBobHarryHarry
6AndyMaryAndyMary
7AndyJohnJillAndy2
Sheet1
Cell Formulas
RangeFormula
F7F7=CountPair(A1:D7,"Andy")
 
Upvote 0
Solution

Forum statistics

Threads
1,216,118
Messages
6,128,939
Members
449,480
Latest member
yesitisasport

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