# Count Combinations Of Values In 2 Columns

May 9, 2008

Have a monthly report process in which I need to count to combinations of values in 2 columns. Example:

A 1
A 1
A 2
A 3
B 2
B 1
B 3
B 3
B 4

Count results: A&1 = 2, A&2 = 1, etc. I'd like to get a summary table of the results. I see how to use sumproduct to count combinations, but that requires a sumproduct formula for every combination. The 2 colums are lengthy and the contents vary each month, so building the formulas each month will be a fair amount of work. Is there another way?

ADVERTISEMENT

## Count Combinations Across Multiple Columns?

Apr 23, 2013

I need to count how many times a code appears over a 6mth period only on a single day. The data would look something like:-

1/1 2/1 3/1 4/1 5/1 6/1 7/1 8/1 9/1 10/1 etc
a b c a a b a a b b

If counting b the result would be 2 on the above 10 days as it appears on the 9/1 & 10/1 it would not be included. It is to be used to count the number of times somebody only appears on a single day over a period of time but not count them if they come back the next day.

I cant think of a way to do this using in built formulas (Countifs, sumproduct, etc) The example is basic and there could be up to 20 codes.

## Count Quantity Of Unique Combinations Of Multiple Columns

Apr 20, 2014

I have two columns in a spreadsheet, and I need to write a formula to determine how many times each combination shows up. Example:

SKU-A Location1
SKU-A Location1
SKU-A Location2
SKU-B Location1
SKU-B Location7
SKU-B Location7
SKU-B Location8
SKU-B Location8
SKU-B Location8
SKU-B Location8

I want it to have the data converted to be like this (with the third column being the the number of times that combination appears):

SKU-A Location1 2
SKU-A Location2 1
SKU-B Location1 1
SKU-B Location7 2
SKU-B Location8 4

## Count Unique Values In Column Based On Values In Other Columns

Mar 14, 2014

I'm running into an issue trying to calculate unique values in a Data column based on a few variables in other columns.

My current formula in Summary tab D4:D19 is
{=SUM(IF(FREQUENCY(IF(Data!\$I\$3:\$I\$66<\$E\$1,IF(Data!\$A\$3:\$A\$66=\$H\$1,
IF(Data!\$C\$3:\$C\$66=A4,ROW(Data!\$I\$3:\$I\$66)))),ROW(Data!\$I\$3:\$I\$66)),1))
+
SUM(IF(FREQUENCY(IF(Data!\$I\$3:\$I\$66<\$E\$1,IF(Data!\$A\$3:\$A\$66=\$I\$1,
IF(Data!\$C\$3:\$C\$66=A4,ROW(Data!\$I\$3:\$I\$66)))),ROW(Data!\$I\$3:\$I\$66)),1))}

This is currently counting the number of times a date value (data column I) appears for that name (A4:A19) in the data when meeting all of the conditions. I need it to instead count the number of times a unique date appears for that name with the additional conditions met (which all appear to work fine).

The results in the pink highlighted cells (Summary column D) should be:

Names starting with A - 3
All others - 2

I've left some other columns in the data with X's so that I can easily convert this back to my working spreadsheet.

## How To Count All Possible Combinations

Oct 24, 2008

I have a table:
VOICEDATAIPADSLCustomer 1YESCustomer 2YESYESCustomer 3YESYESCustomer 4YESYES

And i need to count all possible combinatins. Result could be as:

Custome who use Voice also use combination:1VOICE ADSLCustome who use Data also use combination:1DATAIP2DATAADSLCustome who use IP also use combination:1IPDATACustome who use ADSL also use combination:1ADSLDATA

## Count Number Of Times Text Combinations Appear In Same Column

Oct 6, 2013

A1:A10 contains text (say colors) and B1:B10 also text (say vegetables). I need a formula to count the number of times a certain combination of numbers and vegetables appear in the same column, so if "red" and "carrot" appeared in A4 and B4 and also in A6 and B6, the result would be 2.

## Count Two Different Text Values Within Two Columns

Jun 1, 2006

I need to count two different text values within two columns.

Column A contains sentences and Column B contains various values.

Example of small sentences in Column A:
Custom XX Upgrade
Printing reports on XX
Custom YY Upgrade

Example of values in Column B:
AAAA
BBBB
BBBB

What I need to do is count groups of records, like only counting the records
that contain “XX” anyplace witihin Column A plus have “XXXX” in Column B.

## How To Count Rows With Defined Values In Multiple Columns

Nov 7, 2005

I need a formula or function that will sum the number of occurences a
specific text string is entered into cells in column B. I only want to count
the occurences when a number that is in column A (on the same row as the
text) is equal to a specific number. Sounds easy but it's very frustrating.

## Compare Data In 2 Columns With Values That Have Exceeded 1,048,576 Count

Jul 22, 2012

I have an Excel macro which works well in comparing two columns A and B. It populates column C with unique values in A and not in B, populates column D with unique values in column B and not in A and puts the values found in both A and B in the fifth column (E).

Data in the columns A and B of Sheet 1 has exceeded 1,048,576 (the maximum allowable in Excel 2007) and i will copy the overflow data in Sheet 2's column A and B and i will like the comparison to continue in the next worksheet.

I need the macro to treat the second worksheet as a continuation of the first sheet and not as a separate data. (The values i am comparing have exceeded 1million).

Sub twocols()
Dim d As Object, na&, nb&, a, b
Dim e, p&, q&, r&, m
Set d = CreateObject("scripting.dictionary")

[Code] .......

## Generate All Combinations From 2 Columns NOT Permutations

Feb 14, 2013

I have two columns of data in a worksheet, and I need a third column that shows all of the possible combinations of the data in those two columns. For example:

A
A
AA

B
B
AB

[Code] .....

I don't need permutations so, for example, the third column should only give the combination "AB" and exclude "BA".

## Delete Duplicates Value Combinations From Two Columns?

Mar 29, 2013

I have two columns of data, one with an ID # and the other one with a date. Some ID# + date combinations are repeated and I need to delete the duplicates. Here is a visual:

ID# date
54 19720211
54 19720211
54 19810512
67 19590312
89 19931104
89 19931104

I need to keep only unique ID/date combinations. I would need the final list to look like this:

ID# Date
54 19720211
54 19810512
67 19590312
89 19931104

## Finding Unique Combinations Of 2 Columns

May 30, 2008

I have a spreadsheet with two columns:
The first one will always have a 'W' or a 'E'.
The second one will have a three digit code. Like this:

W 507
W 507
W 507
E 504
E 504
W 505
W 505
W 504
W 504

Is it possible to have output that show how many of each combination there is? Like this(for the example above):
W 504 2
W 505 2
W 507 3
E 504 2

## Counting Combinations Where Same Field Data Can Be In Different Columns

Dec 19, 2012

What I am trying to achieve using the example below:

ID Subject 1 Subject 2 Subject 3
1 Italian French German
2 Italian Art Physics
3 German French Italian
4 French Italian German

the result:

Italian French German 3
Italian Art Physics 1

As in the example, the combinations of Italian, French and German where counted, irrelevant of whether the subjects are in 2nd, 3rd or 4th column.

I tried to do this task by creating a pivot table but there are so many permutations and subjects that it would take me a long time to add the combinations.

## Combinations/Permutations Of Values

Oct 5, 2006

I have a number 23753.2570, to be precise.

in another column, i have 400 rows filled with different numbers, from 1.4 to 23000,7840.

I need to find out all the possible combinations of which numbers from that 400 can make up 23753.2570.

so if my number was 40,000, and i had 4 cells with 10,000 in them, the outcome will be:

"There are 4 possible combination to your value"
then paste it into a new worksheet with the results
[cell1] = 10000 + [cell2] = 10000 + [cell3] = 10000 + [cell4] = 10000
Total = 40000

i found this code, but i tested it on the example above and it said "All Combinations exhausted" which they wasn't?

Sub findsums()

'This *REQUIRES* VBAProject references to
'Microsoft Scripting Runtime
'Microsoft VBScript Regular Expressions 1.0 or higher

Const TOL As Double = 0.000001 'modify as needed
Dim c As Variant

## Number Combinations :: 25 Random Numbers (5 Digit Combinations)

Dec 15, 2008

I have 25 random numbers and I would like to get a possible 5 digit combinations of these numbers. Can anybody help me with the possible formula?

## Get All Unique Combinations From 6 Columns (multiple Rows) Into 7th Column

Jul 2, 2014

I have a table with 6 columns (A to F) and multiple rows each, with cells containing words. Taking the words in any one cell from each of the columns in order from A to F will form a complete sentence each time. I need a solution to display all unique possible combinations in column G.

The number of rows is different for each column. A successful result in column G has to include cells from all columns (A to F).

I searched this forum and found a few analogous questions/solutions, but nothing close enough for me to apply to my case. I tried using a concatenation formula, but I have to manually edit the formula in each cell to get all unique combinations (and that would mean thousands of times). If I just drag the formula down it will increment all cell rows instead of one cell's row at a time.

Here's an example : all possible unique combinations.jpg

## List All Possible Combinations Of Single Range In Two Separate Columns

Apr 25, 2013

I have a single rangle of numbers in Column A, and in Columns B and C and want to list all possible combinations of these numbers. If there is a possible solution without using a Macro I would perfer that, but if not I'll take what I can get.

Example Desired Output:

Column A:
Column B:
Column C

0001
0001
0001

[Code] ......

## All Number Combinations From Entries In 7 Columns And 3 Rows With No Duplicates?

Dec 2, 2013

I have 7 columns x 3 rows with unique numbers. I wish to determine every combination of the above numbers without repeats.

5
11
17
24
29
35
40

[Code] ........

Column 1 would only use column 1 numbers.
Column 2 would only use column 2 numbers...etc.

Also have the same for 5 rows of unique numbers.

I've been working on this for 10 years and this is the last step to finalizing the WINNING numbers.

Back checking using the 5 row technique I would have spent 10,000,000.00 playing over 8 years with a winners purse of 33,000,000.00

With the 3 row I would have spent close to 200k and won 2.5 mil.

Only problem is that I don't have the 10 to start with, the 200k is a maybe .

I need to be able to generate the combinations to play the numbers.

## Compare Combinations Of Values / Transactions

Jan 25, 2014

I need to compare in and out of money in multiple bank accounts.

Imagine in row one i have all the "INs"
and in row two i have all the "OUTs"

Now, how do i compare say first transaction in row one to say 5 transactions in row 2 and find the relationship
It can be:

1. Transaction IN 1 = Transaction OUT 3
2. Transaction IN 1 = Transaction OUT 2+4
3. Transaction IN 1 = Transaction OUT 3, or Transaction OUT 2+4

So if its a direct relation it just displays where they are equal, if they aren't how it will display which multiple transactions will be equal, and if there are 2 different possibilities it will show both answers.

If its only In = Out its pretty straight forward, but how do i code it to search for combinations of transactions say 1+2+5 efficiently.

## Search And Delete Combinations Of 4 Specific Numbers Stored In 5 Columns?

Aug 28, 2012

I attached partial file so you can see what i mean. I pasted only a few combinations cause the file was to big and i wasnt able to attach it...there are 142506 combinations . But you can see what i mean. A VBA or a macro on the worksheet will do the job?

## Create Table Of All Possible Combinations Based On 4 Values

Mar 6, 2012

I'm trying to create a table of all possible combinations based on 4 values (8,4,2,-2) into 6 columns. An example is below of what the table should look like

Field 1Field 2Field 3Field 4Field 5Field 688888888888488884488844488444484444488888288882288822288222282222222222288888-244-2-2-2-2444444884422

## How To Generate All Combinations Of Ten Values List / Picking In 4 Each Combination

Oct 20, 2013

I have a list in excel with ten values, but I need to get all combinations possible, picking 4 of 10 each combination. This must be as a combination and no permutation or variations either, I mean, values can't be repeated in a single combination.

I'm struggling to do this in a Macro but I don't get it.

## Count Values In One List And Then Narrow / Combine Values Based On Criteria And Count Those

Jan 20, 2014

I need a way to find a value in a column which has one or more corresponding values in an adjacent column. Then take all of the corresponding values found and count all occurrences of the found values in another column. But I only want to count the entries if an adjacent column is not blank.

Not the easiest thing to describe. Starting to wonder if I need to think in reverse. I hope the attached example makes more sense.

Book1.xlsx

## Number Combinations :: Between 7 To 15 (6 Digit Combinations)

Jun 30, 2008

What I am looking for is to select between 7 and 15 numbers in total, I want all the possible 6 digit combinations for this.

EG: if I choose 2,9,11,13,15,17&26, it would look something like this

2,9,11,13,15,17
2,9,11,13,15,26
9,11,13,15,17,26
And so on.

If I chose more numbers (10) 1,2,3,4,3,6,7,8,9,10 it would start something like this

1,2,3,4,5,6
1,2,3,4,5,7
1,2,3,4,5,8
1,2,3,4,5,9
1,2,3,4,5,10
And so on.

Please remenber I would like to be able to secelt between 7 and 15 number and be given all the possible combinations.

I would like it to be in one sheet but if that can not be done on as many as it takes.

It would be good if I could just type the required number into A1,B1,C1 and so on and they just gave the combinations required.

## Conditional Summing: Find Those Combinations Of Variable Values Which Generate Highest Total Gain

Jun 17, 2008

The aim is to find those combinations of variable values which generate highest total gain. I attached the spreadsheet which shows the variables (A through K) and a Gain column. I created 5 additional tabs which show all possible 2,3,4 and 5-member combinations of the variables. These tabs are like coordinates of which variable combinations should be examined. As an example I used the first combination from the second tab = A and B. If you look at these two columns on the EXAMPLE CALCULATION tab you will see 7,7 in the Number combination which is the first number pair for these two variables. The headings of the red and the yellow columns calculate the total count for this number pair and the total gain. These were recorded on a separate EXAMPLE RESULTS tab along with some other pairs which appear afterwards (these were recorded only from the first 39 rows of the AB data). I need a macro which will cycle through each variable pair (only using the combinations from the tab 2 for now, annd later from 3,4 and 5 tabs) collecting statistics for each unique number combination it encounters (printing to a separate sheet one after one), such as shown on the EXAMPLE RESULTS.

## Count Formula: Count Total Entries In Columns

Feb 22, 2007

I have been using the wrong formula to count total entries in columns and only just found this error. The MAX formula in cell B4 is: =MAX(\$B\$12:\$B\$36). If the all the rows are full within range F12:F36, then the MAX formula is fine to count the total within range B12:B36 (25) so I thought. But sometimes there are omissions between F12:F36. If there are 2 blank cells anywhere within F12:F36 for example, then B4 needs to show 23 respectively. In the sample WkBk B4 needs to show 8

## Count Intervals Of 2 Numeric Values In Same Row And Return Count Across Row

Sep 23, 2005

I require a Formula to calculate the INTERVALS (the number of Rows between
the LAST instance and the PREVIOUS instance in a column) between each
individual occurrence of any designated PAIR of Numeric values (single-digit
/ double-digit) in the same Row of the Named Range "Results" and return each
calculated INTERVAL result to a separate Column on the same Row of a New
Sheet - starting with the most recent ( the LAST) occurrence.

For instance, each time 80 and 87 appear together in the same Row, return the
INTERVAL by calculating the number of Rows between the LAST instance and the
PREVIOUS instance in a column - locate when both Numeric values LAST appeared
together and Count back to their PREVIOUS appearance together to get the
required Count; i.e. count from the Row ABOVE LAST appearance to the Row
BEFORE PREVIOUS appearance.

The results are returned to a chart / matrix layout: I have the criterion
vertically and horizontally and they are referenced using the horizontal and
vertical cell address that houses each criterion, and the results are
returned across the Row of the intercept of the vertical and horizontal
criterion. At some point both criterion values being referenced will be the
same, can the Formula return empty text "" when this occurs?

Example Chart / Matrix Layout:
Cell Ref. A2 and B1 criterion 80 and 80
Cell Ref. A3 and B1 criterion 81 and 80
Cell Ref. A4 and B1 criterion 82 and 80

Criteria B1 houses 80
A2 houses 80
A3 houses 81
A4 houses 82
A5 houses 83

## Macro To Give Count Of Unique Values After Comparing Comma Separated Values?

Mar 2, 2014

I need a Macro (not formula) which compares the comma separated values present in Column "I" with individual values present in Column "D" and generate the count of unique values in Column "J".

The sample sheet has been attached for reference.

## Count Unique Values, For Specific Values

Sep 13, 2006

I have an array that I'm using - and it works perfectly: =SUM(If((FREQUENCY(If(LEN(B10:B100)>0,MATCH(B10:B100,B10:B100,0),""),If(LEN(B10:B100)>0,MATCH(B10:B100,B10:B100,0),""))>0),1))

Now, what I would like to do, is see how many of these unique numbers relate to another number in column D
See attachment.

## Counting Formula (compare Values In 2 Separate Columns To See How Many Times The Same Value Appears In Both Columns)

Oct 13, 2008

I'm trying to compare values in 2 separate columns to see how many times the same value appears in both columns. Ideally I would be able to insert a range function to compare the values in the column "ID 1" against the values in column "ID 2" and return the count of times that a value appears in both columns. For example 2122, 1112 and 1718 appear in both columns and I would like the formula to return a count of 3.

ID 1ID 2
12342122
45671112
89101718
11122678
13144544
15162324
17189987
19201215
21221928
1976
2576
2345
4678

In my actual project I'm comparing 2 columns in the same worksheet. The column are column B with data in cells B2:B10266 against column C with data in cells C2:C18560.

Copyrights 2005-15 www.BigResource.com, All rights reserved