Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Combinations for Members in Meetings.

Combinations for Members in Meetings

by Allen Wyatt
(last updated July 18, 2015)

1

Bob has a worksheet that has member names down the left side and months of the year across the top. In each cell of the grid he enters the dates on which meetings occur that were attended by the member. Bob is looking for a way to tell at a glance who has not met with whom.

There are several ways that a solution to this problem can be approached. If your table design is flexible, you can "simplify" things by changing the way your table is laid out. Instead of putting months across the columns, you can simply have each column be a meeting date. Then, each cell could contain some sort of indicator (a number or a character) that indicates the person attended the meeting on that particular date. It would be a relatively easy process to figure out who had not met with whom:

  1. Choose the key member, the one you want to check, and move him/her to the top of your data table.
  2. Sort the data table horizontally on the key member row, so all the meetings that the key member attended are in the left-most columns.
  3. Sort everyone except the key member vertically on the first three meeting dates. Everyone who met the key member in those three meetings is now at the top of the data table, just below the key member.
  4. Move down the data table and select everyone who has not yet met the key member and sort on the next three meeting dates.
  5. Repeat steps 3 and 4 until all meeting dates have been sorted.
  6. Everyone remaining at the bottom of the data table (those not selected in steps 3 and 4) has never met the key member.

If you cannot change the format of your table, then a macro solution is called for. There are many approaches that could be used in a macro, but the following is perhaps the most direct:

Sub PeopleNotMet()
    Dim rTable As Range
    Dim rOutput As Range
    Dim iCols As Integer
    Dim iCol As Integer
    Dim iRows As Integer
    Dim iRow As Integer
    Dim iCompRow As Integer
    Dim sNotMet As String
    Dim sMet As String

    Set rTable = Worksheets("Sheet1").Range("A1").CurrentRegion
    Set rOutput = Worksheets("Sheet2").Range("a1")
    sNotMet = "X"
    sMet = ""

    Application.ScreenUpdating = False
    With rTable
        iRows = .Rows.Count
        iCols = .Columns.Count
        
        .Columns(1).Copy
        With rOutput
            .PasteSpecial
            .PasteSpecial Transpose:=True
            Application.CutCopyMode = False
            Range(.Offset(1, 1), .Offset(iRows - 1, _
              iRows - 1)).Value = sNotMet
            Range(.Offset(1, 1), .Offset(iRows - 1, _
              iRows - 1)).HorizontalAlignment = xlCenter
        End With
    End With
    With rTable.Cells(1)
        For iRow = 1 To iRows - 1
            For iCol = 1 To iCols - 1
                For iCompRow = 1 To iRows - 1
                    If Not (IsEmpty(.Offset(iRow, iCol))) Then
                        If Not (IsEmpty(.Offset(iCompRow, iCol))) Then
                            If .Offset(iRow, iCol).Value = _
                              .Offset(iCompRow, iCol).Value Then _
                              rOutput.Offset(iRow, iCompRow).Value = sMet
                        End If
                    End If
                Next
            Next
        Next
    End With

    Set rTable = Nothing
    Set rOutput = Nothing
    Application.ScreenUpdating = True
End Sub

This macro assumes a couple of things. First, it assumes that Bob's original data table is on Sheet1, starting in cell A1. Second, it assumes that the "who has not met with whom" table should be on Sheet2, beginning at cell A1. If these assumptions are correct, then when you run the macro, the table created on Sheet2 shows names down the left side and names across the top. The intersecting cells will contain either nothing (which means that the people have met) or a capital X (which means they have not met).

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (248) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Combinations for Members in Meetings.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Selecting a Word

Selecting text is a critical skill to possess when you want to work with a Word document. This tip explains how you can ...

Discover More

Matching At the Beginning or End of a Word

The pattern matching capabilities of Word's search engine are quite powerful. You can tailor your search pattern so that ...

Discover More

Changing Many Link Locations

Word makes it easy to establish links between documents. If you need to change the locations for a lot of links at once, you ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

MORE EXCELTIPS (RIBBON)

Calculating the Median Age of a Group of People

Suppose you have a worksheet that contains a list of ages and then a count of people who correspond with those ages. You may ...

Discover More

Summing Based on Part of the Information in a Cell

Excel provides a variety of tools that allow you to perform operations on your data based upon the characteristics of that ...

Discover More

Generating Double-Digit Random Numbers

Normally you use the RAND and RANDBETWEEN functions to generate random numbers. What if you want to generate random numbers ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments for this tip:

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 7 + 8?

2015-07-20 12:44:54

David Bonin

Seems to me there's a simpler way to do this.

Create a square table (same number of rows as columns) with the names of each person cross the top and down the left side. Let's say there are 12 names. This means the table would have 12 x 12 = 144 cells, plus the 12 names across the top and 12 names down the left side.

The order of names is important. Put the names above the columns first. Then put the names down the left side of the table in the EXACT opposite order.

Now, every time a two people meet, put the date in the intersection of their row and column. For example, when Bob and Mike meet, enter the date of their meeting where Bob's column meets Mike's row.

Of course, there is a second intersection where Mike's column meets Bob's row. What do we do about that? The simplest thing is to not fill in any cells in the lower right triangle of the table. You can apply gray shading to the cells if you like. The first row would have all 12 cells. The second would have 11 cells. The third, ten, and so on.

That takes us from 144 cells down to (12 x (12 + 1)) / 2 = 78 cells.

What else might we do?

Well, There is no such thing as Mike meeting with Mike, nor Bob meeting with Bob. This means that we can ignore the cells on the diagonal from the bottom left to the top right. Shade them gray, too. That removes more 12 cells.

In our example, if we have 12 people, then there ((12 x (12 - 1)) / 2 = 66 possible meetings, twelve less than our first calculation.


Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.

Links and Sharing
Share