+ Reply to Thread
Results 1 to 5 of 5

Count Pairs

  1. #1
    Forum Contributor
    Join Date
    08-06-2006
    Location
    Spain
    MS-Off Ver
    Excel 2010 32Bit
    Posts
    545

    Count Pairs

    Using Excel 2010

    Hello,

    I have lottery numbers in columns D:H I want to count each pair listed in range K3:T4 in there column, example pair 1&2 in column K, pair 1&3 in column L, and so on…..

    Need VBA help? Example workbook attached.

    Regards,
    Moti
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,062

    Re: Count Pairs

    Motilulla,
    Can you explain more on what you're trying to do? For instance, you said "example pair 1&2 in column K, ". So are you wanting a count of every time a 01 and a 02 both appear in the same row in D:H? Or do 1 and 2 relate to n1 and n2? Your sample is confusing without a good explanation and example.
    I know I'm not stupid, but I suspect I'm a lot stupider than I think I am

  3. #3
    Forum Contributor
    Join Date
    08-06-2006
    Location
    Spain
    MS-Off Ver
    Excel 2010 32Bit
    Posts
    545

    Re: Count Pairs

    @jomili, thank you for your replay, true is I want to count of every time any pair, example pair 01 and a 05 appear in the same row in D:H in any position

    Whether example 01 and 05 can be relate to n1 and n2, n1 and n3, n1 and n4 or n1 and n5 position does not matter it must be counted under 01 and 05 in the column N, hope this help.

    Regards,
    Moti

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,415

    Re: Count Pairs

    Are you required to use VBA? It looks like it should be a simple worksheet formula. Something like:

    1) A COUNTIFS() function to determine if the value in row 3 occurs in this row of data. COUNTIFS($D6:$H6,K$3). A similar COUNTIFS() function for the value in row 4 COUNTIFS($D6:$H6,K$4). These will each return 1 if the value exists and 0 if it doesn't.
    2) Add the two COUNTIFS() together. If this sum is 2, then both values existed. If it is 1 or 0, then both values do not exist.
    3) Nest that inside of an IF() function to choose what to return =IF(COUNTIFS(...)+COUNTIFS(...)=2,1,""). As programmed, I see it being entered in K6. Note the mix of relative and absolute references and copy/paste/fill into K6:T305.

    Does that help?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  5. #5
    Forum Contributor
    Join Date
    08-06-2006
    Location
    Spain
    MS-Off Ver
    Excel 2010 32Bit
    Posts
    545

    Re: Count Pairs

    @MrShorty, formula is ideal it worked fine! Thank you

    Regards,
    Moti

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Count added pairs
    By zzz111 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-28-2019, 07:11 PM
  2. To count and list the pairs of numbers data help
    By subra2015 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-27-2016, 02:14 AM
  3. [SOLVED] Count pairs of values in adjacent columns (either way around)
    By Alfie101 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-23-2016, 03:50 AM
  4. Count pairs within a spectrum
    By Nspencer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-03-2014, 06:19 AM
  5. Count number of pairs between 2 columns
    By Johnald in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-09-2013, 06:46 PM
  6. Count Pairs of Numbers
    By semperfi360 in forum Excel General
    Replies: 12
    Last Post: 02-13-2009, 11:10 AM
  7. Count pairs
    By Excelenator in forum Excel General
    Replies: 2
    Last Post: 10-02-2006, 06:25 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1