Counting combinations of values in table of values excel? - excel

I have a table of values with each value in a different cell
e.g.
2 9 12 19 41 45 14 39
12 14 19 27 39 40 30 44
6 9 13 15 16 41 7 20
8 16 14 34 13 44 5 15
10 11 20 24 27 36 9 41
Is there a way to find which pairs of numbers are most common.
i.e.
13 & 15 appear 2 times
14 & 44 appear 2 times
24 & 27 appear 1 time
I was hoping for a formula as the table has over a hundred rows in it so would be time consuming to count manually.

The formula you would want would be the one for the row totals of a pair of numbers in A2 and B2:
=SUM(MMULT(--($E$2:$L$6=A2),TRANSPOSE(COLUMN(E:L))^0)*MMULT(--($E$2:$L$6=B2),TRANSPOSE(COLUMN(E:L))^0))
entered as an array formula using CtrlShiftEnter
There will be formulas for for listing distinct pairs up to a certain number out there - I used
=IF(ROW()=2,1,IF(B1<45,A1,A1+1))
for A2 and
=IF(B1<45,B1+1,2+COUNTIF(B$1:B1,45))
for B2.
If you scroll down this list you can see that 13,16 occurs twice as well as 13,15.
9,41 occurs three times.
Note - I am assuming the numbers are like lottery numbers and any one number can only occur once in a row. The formula could easily be modified to account for duplicates within a row.

Related

How to transpose column in several rows in excel

is there a way to transpose one column in excel into several rows. For example I have one column with 100 rows and I want to transpose it but also split it in several rows with 3 columns.
I have this:
21
34
2
56
23
12
34
18
22
...
I need this:
21 34 2
56 23 12
34 18 22
...
Thank you very much in advanced!
You could try this:
The formula used in C1 translates to:
=INDEX($A$1:$A$9,ROW(A1)*3-3+COLUMN(A1))
You can drag it sideways and down.

Excel: Subtracting One Value from the Next Entry in Column

I have a set of data that has two columns, one for enumerating entries, and the second for storing a value:
1 0.000000000
2
3
4
5
6
7
8
9 0.664076596
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 0.668394223
The values in column 2 are separated by varying numbers of rows throughout my data sheet. I want to subtract each value (Value B) in column 2 by the previous value above it (Value A) (ie 0.664076596 - 0.000000000, and 0.668394223 - 0.664076596 etc.). I want to put these results in the third column and next to Value B. How would I do this in Excel?
Use this which will find the last number value in the column before the current row.
=IF(B2="","",IFERROR(B2-INDEX($B$1:B1,MATCH(1E+99,$B$1:B1)),B2))

find the number of skip rows between records

I have requirement to get row number of next matching value. ie.
Number 1 Number 2 Number 3 Number 4 Number 5 Number 6
16 33 28 20 23 14
13 12 27 29 2 32
31 25 9 28 17 10
11 22 14 3 18 13
12 39 22 32 25 24
37 40 33 18 9 3
4 35 17 24 7 12
16 3 38 8 17 24
now 16 is present in 7th row, and skipped rows are 6. 33 is present in 6th row so skipped rows are 5. Similarly 28 is present in 3rd row so skipped rows are 1.
output will be :
6 4 1 19 10 2
assume that 20 and 23 found in 20th and 11th row respectively.Skipped rows = row number of next find of that number - present row number.
I am not able to form formula for this. Match should work I guess, but not sure.
Put this formula in the first cell:
=AGGREGATE(15,6,ROW($A$3:$F$22)/($A$3:$F$22=A2),1) - ROW($A$3)
Then drag/copy across
If you want to drag down (put the results in columnar form):
=AGGREGATE(15,6,ROW($A$3:$F$22)/($A$3:$F$22=INDEX($2:$2,ROW(1:1))),1) - ROW($A$3)
Put it in the first cell and drag/copy down.

Excel number combination comparison

I need to compare the sets of numbers on the left (six numbers row) to the ones on the right (six numbers per row). I need to find combinations that are the same; for example, notice that row 1 on the left is the same as row 3 on the right. The program must identify this and highlight on the left set on numbers.
LEFT HAND SIDE
2 15 26 27 36 48
1 12 13 15 24 34
3 5 20 28 37 40
RIGHT HAND SIDE
3 15 19 29 39 35
1 2 27 48 24 37
15 2 26 47 27 48
Here's one way of doing it: combine the numbers (assumed to be a maximum of 2 digits - they look like lottery numbers) in the correct order into a single large number in another column and match on this column. In column G and copied to column N:-
=SUMPRODUCT(SMALL(A2:F2,COLUMN(A2:F2)-COLUMN(A2)+1)*100^(COLUMN(A2:F2)-COLUMN(A2)))
Then in Conditional Formatting| New Rule | Use a formula :-
=MATCH($G2,$N$2:$N$4,0)
If you wish you can also do a reverse lookup on each right-hand set of numbers as shown below.

divide data in one column into more column in excel

i want to do this in Microsoft Excel 2007
This a one column. I have 20098 data in one column like below.
1
2
3
4
5
6
7
8
131
1
31
31
31
31
41
I want to rearrange those data like this how can i do it
1 4 7 1 31
2 5 8 31 31
3 6 131 31 41
If your data was in column A then in cell B1 put
=OFFSET($A1,3*(COLUMN()-COLUMN($B$1)),)
and copy down and right to split your data as desired
use this formula in all 3 rows and 6700 columns of the resulting range:
=INDEX($A:$A;(COLUMN()-first_column)*3 + ROW()-first_row+1)
where first_column is =column(..) and first_row is =row(..) of the cell where you want to have the 1st value
e.g. if you use B1:IWS3 range to list the results, the formula will be:
=INDEX($A:$A;(COLUMN()-2)*3 + ROW())

Resources