Excel pivot/group/transpose - excel

Data presented like this (3 rows with same key 1,2 etc):
k va vb
1 A11 B11
1 A12 B12
1 A13 B13
2 A21 B21
2 A22 B22
2 A23 B23
...
I need to group and transpose each group so I get (dont need keys even)
va1 vb1 va2 vb2 va3 vb3
A11 B11 A12 B12 A13 B13
A21 B21 A22 B22 A23 B23
...

You could use something like:
=INDEX($B$2:$C$7,(ROWS($A$1:$A1)-1)*3+(COLUMNS($A$1:A$1)-1)/2+1,2-MOD(COLUMNS($A$1:A$1),2))
Adjust the first range (the $B$2:$C$7 part) to match your actual data set

Related

Which is the best way to move cell values to column based on rows in Excel?

I am having values in Excel sheet in the following format:
code
Warehouse
Quantity
A5
G1
3
A2
G1
4
A2
G2
60
A3
G2
20
How can I move the quantities from the above rows to warehouse columns like this
code
G1
G2
A5
3
0
A2
4
60
A3
0
20

Return Value based on 2 criterias

ive noticed that similar question has been answered before but non are what i am looking for.
Sheet 1
Site Program Data Finished
A1001 B3
A1001 B5
A1001 B6
A1002 B3
A1003 B6
A1003 B5
Sheet 2
Site Location Date Released Program Data Finished
A1001 Chicago 1/3/2018 B6 6/5/2016
A1002 Chicago 1/4/2018 B3 1/3/2018
A1001 Chicago 1/1/2018 B3 4/5/2016
A1001 Chicago 1/2/2018 B5 1/1/2018
A1003 Chicago 1/5/2018 B6 4/5/2016
A1003 Chicago 1/6/2018 B5 1/1/2018
A1004 Chicago 1/7/2018 B4 1/2/2018
i need to return the Date Finished Values from Sheet 2 under Date Finished in Sheet 1 based on 2 criterias: the Site and Program.
So look for Site A1001 with B3 program under sheet 2 and return the Date Finish in sheet 1.
i'm stuck.... i have this formula but its not doing the job.
=IFNA(IF(VLOOKUP(VLOOKUP($A2290,[Capital Projects.xlsx]Modification'!$D:$D,1,0),'[Capital Projects.xlsx]Modification'!$D:$I,6,0)="5GmmW", VLOOKUP($A2290,[Capital Projects.xlsx]Modification'!$D:$EG,55,0),""),"")
Using structured references, with Table1 being the table on sheet2:
=AGGREGATE(14,4,(Table1[Site]=A2)*(Table1[Program]=B2)*Table1[date finished],1)
You can use regular references instead of a Table, but just ensure they cover more than the expected number of rows.

Match two column values from 2 data sets, then find associated values

The issue I'm having was hard to title, and hard to search as well.
Here's some example data.
A B C D E F
B1 04/14/16 746 B1 04/25/16 2
B1 04/15/16 180 B1 04/30/16 4
B1 04/16/16 494 B1 05/01/16 5
B1 04/17/16 726 B2 04/01/16 1
B1 04/18/16 206 B2 04/03/16 1
B1 04/19/16 22 B2 04/04/16 2
B1 04/20/16 193 B2 04/05/16 2
B1 04/21/16 739 B2 04/12/16 8
B1 04/22/16 926 B2 04/13/16 1
B1 04/23/16 748 B2 04/14/16 2
B1 04/24/16 830 B2 04/15/16 1
B1 04/25/16 272 B2 04/18/16 9
B1 04/26/16 0 B2 04/19/16 1
B1 04/27/16 0 B2 04/26/16 9
B1 04/28/16 0 B2 04/27/16 3
B1 04/29/16 0 B2 04/30/16 1
B1 04/30/16 685 B2 05/02/16 5
B1 05/01/16 770 B2 05/03/16 2
B1 05/02/16 701 B3 04/03/16 3
B1 05/03/16 181 B3 04/04/16 1
B2 04/01/16 77 B3 04/06/16 2
B2 04/02/16 182 B3 04/07/16 1
B2 04/03/16 53 B3 04/09/16 1
B2 04/04/16 32 B3 04/16/16 7
What I'm trying to do is check for matching A and D columns, as well as matching B and E columns. If the columns match I would like to take column F and divide by column C.
Also if there is no match for both A and B column values, then have return those values with a zero.
So for a match:
B1 04/25/16 =2/272
For a non-match:
B1 04/14/16 0
Thank you.
Two INDEX/MATCH Function will do it:
=IFERROR(INDEX($F$1:$F$24,MATCH(1,INDEX(($E$1:$E$24=J2)*($D$1:$D$24=I2),),0))/INDEX($C$1:$C$24,MATCH(1,INDEX(($B$1:$B$24=J2)*($A$1:$A$24=I2),),0)),0)
This is an array formula, Full column references should be avoided as the calculation are exponential and will increase the calculation times.
If a more dynamic range is wanted then use this formula:
=IFERROR(INDEX($F$1:INDEX(F:F,MATCH(1E+99,F:F)),MATCH(1,INDEX(($E$1:INDEX(E:E,MATCH(1E+99,F:F))=J2)*($D$1:INDEX(D:D,MATCH(1E+99,F:F))=I2),),0))/INDEX($C$1:INDEX(C:C,MATCH(1E+99,C:C)),MATCH(1,INDEX(($B$1:INDEX(B:B,MATCH(1E+99,C:C))=J2)*($A$1:INDEX(A:A,MATCH(1E+99,C:C))=I2),),0)),0)
This will find the last cell with data and use that to set the extents of the range. So now as the data grows or shrinks it will only look at the data and not iterate through any more or any less than what is needed to cover the entire data set.

finding Minimum value based on a range of values in another column in excel vba

10.00 b1
11.00 b2
22.00 b3
2.00 b1
323.00 b2
1.00 b3
423.00 b1
32.00 b2
42.00 b3
43.00 b1
522.00 b2
53.00 b3
22.00 b1
344.00 b2
33.00 b3
23445.00 b1
323.00 b2
4.00 b3
How can I find the minimum value of column1 where value of column2 = b2?
Here, I got one for you. It is an excel formula.
=MIN(IF(B1:B100="b2",A1:A100))

Sum fields in a column if there is an entry in a corresponding row in another column

Assume the following data:
| A B C
--+------------------------
1 | 2 3 5
2 | 2 3
3 | 4 4
4 | 2 3
5 | 5 6
In cell A6, I want Excel to add cells C1, C2, C3 on the basis that A1, A2 and A3 have data in. Similarly, I want B6 to add together C1, C4 and C5 because B1, B4 and B5 have data.
Can someone help?
In A6 enter:
=SUMPRODUCT(($C1:$C5)*(A1:A5<>""))
and then copy to B6:
A simple SUMIF formula will work
=SUMIF(A$1:A$5,"<>",$C$1:$C$5)
Place that formula is cell A6 and then copy it to B6.
You can create another column, e.g. AValue, with the formula =IF(ISBLANK(A1),0,A1) in it. This will return 0 if the cell in A in the corresponding line is empty, or the value from the cell in A otherwise.
Then you can just sum up the values of the new column.

Resources