How to look up for multiple values and convert them in to a horizontal table in excel - excel

I have a table like below in excel spread sheet
A 1
A 2
B 12
B 4
B 56
B 68
C 7
C 8
C 34
D 10
D 11
i need to convert the table as below
First entry Second entry Third entry Fourth entry
A 1 2 - -
B 12 4 56 68
C 7 8 34
D 10 11

Provided your list of letters (assumed to be in ColumnA starting in Row1) is sorted and you have a separate list of just one each of those letters (say starting in D1) then a formula may achieve the results you want:
=IF(COUNTIF($A:$A,$D1)>COLUMN()-5,OFFSET(INDEX($A:$A,MATCH($D1,$A:$A,0)),COLUMN()-5,1),"")
In F1, copied down to suit and then all formulae copied across until an entire column is blank.

Related

Sorting a two column table into a multi-column table

I have a dataset that looks like this:
Attribute Value
A 1
B 2
A 5
B 7
C 2
D 9
A 4
B 2
C 4
I want to transform that into a sheet that looks like
A B C D
1 2 2 9
5 7 4
4 2
So I can feed it into a Box-and-whisker chart generator in Mac excel.
Any thoughts on the easiest way to do this? I may have to do it over and over. The dataset may consist of >100,000 rows, but a reasonable amount of attributes (e.g. less than 200).
This is for Excel 365.
In D1 enter:
=TRANSPOSE(UNIQUE(A2:A10))
In D2 enter:
=FILTER($B2:$B10,$A2:$A10=D$1)
Then copy D2 to E2 throughG2 (or beyond):

Match row and column to get the value from the same row - Matrix

I have a matrix like below,
A B C D E F
A 0 12 13 14 15 16
B 12 0 12 15 15 18
C 11 11 0 12 12 15
D 26 24 25 0 22 25
E 87 86 82 12 0 23
F 11 25 36 14 25 0
Now i want that in the below format,
A A 0
A B 12
A C 13
A D 14
A E 15
A F 16
B A 12
B B 0
B C 12 so on.
How can i achive that in excel via formulae.
As stated Offset is a volatile function in that it will always calculate whenever excel calculates regardless if the underlying data has changed or not.
Index is not volatile:
In A10:
=INDEX($A$2:$A$7,INT((ROW(1:1)-1)/ROWS($A$2:$A$7))+1)
In B10:
=INDEX($B$1:$G$1,MOD((ROW(1:1)-1),COLUMNS($B$1:$G$1))+1)
In C10:
=INDEX(A:G,MATCH(A10,$A:$A,0),MATCH(B10,$1:$1,0))
Then copy down
Assuming your data is fixed width (6 here) and exists in columns A-F. Put the following formulas in J1-L1 and fill down. It uses the offset method and looks at fractions of the row, either the remainder or the integer to determine steps for rows (integer) or remainder via mod function (columns).
=OFFSET($A$1,ROUNDDOWN((ROW(J1)-ROW($J$1))/6,0)+1,0)
=OFFSET($A$1,0,MOD((ROW(K1)-ROW($J$1)),6)+1)
=OFFSET($A$1,ROUNDDOWN((ROW(L1)-ROW($J$1))/6,0)+1,MOD((ROW(K1)-ROW($J$1)),6)+1)
I'm hoping I understand your question. But, assuming you had your matrix starting in the top left of the sheet, you would have:
Going Down:
"A" in cell A2, "B" in cell B2, etc
Going Across:
"A" in cell B1, "B" in cell C1, etc
Data:
Your first value (corresponding to A,A) in cell B2
So, now you havem for example, in cell A10 the row letter you want and, in cell A11 the column letter you want. So, you could use the following formula to get your desired result:
=INDEX($B$2:$G$7,MATCH(A10,$A$2:$A$7,0),MATCH(B10,$B$1:$G$1,0))
Basically, using the INDEX() function on your array and matching the row to the desired row letter and the column to your desired column letter.
Hope that makes sense.

Add values in excel column for distinct values in another column

I have the following layout of column A and B and I need a formula to calculate values in column C:
A B C
1 10 70
1 20
1 10
1 30
2 10 30
2 15
2 5
3 20 25
3 2
3 3
Any ideas or functions which can do this? Basically Sum column B for unique values of column A
In C1 enter:
=SUMIF(A:A,A1,B:B)
and in C2 enter:
=IF(A1=A2,"",SUMIF(A:A,A2,B:B))
and copy down:

Index & Match formula using IF and ISERROR

I have data in columns C & D. A range of ten students in A1 to A10 are identified with roll numbers. In Column C and corresponding Column D, there are 8 students from roll number 1 to 8 (Column C) and their marks (Column D).
I need a formula in column B to automatically extract the marks from column D against the roll numbers in Column A and the two cells in column B (marks of roll number 9 & 10) may remain blank.
Any Excel formula or VBA macro solution is much appreciated.
Column-A Column-B Column-C Column-D
1 50 1 50
2 55 2 55
3 35 3 35
4 60 4 60
5 78 5 78
6 45 6 45
7 39 7 39
8 82 8 82
9
10
Try using VLOOKUP with IFERROR, i.e. this formula in B2 copied down
=IFERROR(VLOOKUP(A2,C$2:D$9,2,0),"")
VLOOKUP will return the required marks when the roll number exists.....or an error which IFERRORconverts to a blank.
The simplest solution would seem to be copy and paste. Alternative solutions would seem to be relatively simple (eg #barry's) but if you really want INDEX, MATCH, IF and ISERROR then maybe:
=IF(ISERROR(INDEX(D:D,MATCH(A2,C:C,0))),"",INDEX(D:D,MATCH(A2,C:C,0)))

Compare two columns in same sheet and find difference

Hi I have an excel sheet with two columns- A and B. Each column has similar data and B has more data than A. How can I spot data which are available in B but not present in A?
A 12 13 14 15 and
B 12 123 13 14 145 15 16
Use CountIf() or Vlookup(). Put in cell C2 this formula =countif(A:A,B2) and copy it down. You'll see 0 when they are unique.

Resources