I need get output using excel formulas - excel

I want to get output on below table using Excel function.
I have tried Index match but it only helps to get output for first value, while I have duplicate values.
Database
Date Product Name
01-01-2016 60 A
01-01-2016 54 B
01-01-2016 40 C
01-01-2016 60 D
01-03-2016 47 A
01-03-2016 39 B
01-03-2016 46 C
01-03-2016 42 D
01-02-2016 37 A
01-02-2016 53 B
01-02-2016 25 C
01-02-2016 46 D
01-04-2016 49 A
01-04-2016 47 B
01-04-2016 46 C
01-04-2016 27 D
Need a help to fill the below table using Excel formula
Kindly find the below sample output
enter image description here

Using your posted "database" graph (the first one) as a reference and assuming that it starts in cell A1, I put your "required output" data in F1:J5. "A" starts in F2, F1 is blank and the dates are in cells G1:J1.
In G2 put this Array formula and then fill down to the last letter "D": = INDEX($B$1:$B$17,SMALL(IF($C$2:$C$17=$F2,ROW($C$2:$C$17),""),COLUMN()-6)). Then fill across. The "COLUMN()-6" in the Small function assumes that you put your "required out" data in the range F1:J5; otherwise, you will need to change it manually.

Related

How to calculate averages IDs in Excel

I have the following data
A B
ID Time
22 00:20
33 00:30
60 01:30
41 00:20
41 00:30
33 01:00
22 01:00
Column A= Id and column B= Time
I want to calculate the average time for IDs and get the following table in Excel
I struggled to do it
C D
ID Time
22 40
33 45
60 90
41 25
Make sure you are using the right formula and have the number format as general.
If you have the unique IDs in column C, and want the average on column D, and row 1 has the titles, you could use this formula in cell D2:
=averageifs(b$1:b$1000, a$1:a$1000, d2)
It means "Average the number in column B if what is in column A matches D2".
Fill down the formula.
Then select column D, press Ctrl-1 (with the numbers on top of the letters) to go to format, and in "General" type [mm].
AVERAGEIF is enough:
=AVERAGEIF(A:A;D2;B:B)
Cell format [mm]

How to find max value for rows of n

I have below data with grouping variable ("Date") and a value variable ("Value"):
Date Value
2/1/2014 7
4/4/2014 8
6/7/2014 8
8/10/2014 88
3/1/2015 87
4/4/2015 65
7/7/2015 55
9/10/2015 43
I want to extract the maximum value for rows of 4 such that I have the maximum values of 88 (cuz first 4 rows) and 87 (the next 4 rows).
How do I do this?
With data in columns A and B, in D1 enter:
="B" & (ROWS($1:1)-1)*4+2 & ":B" & (ROWS($1:1)-1)*4+5
and copy down and in E1 enter:
=MAX(INDIRECT(D1))
and copy down:
Column D defines the data groups and column E gives the max for each group.
Assuming your data is located at A1:B9; enter this formula in C2 and copy till last row of data:
=IF(MOD(ROWS(A$2:A2),4)<>1,"",MAX(B2:B5))

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.

Output range of cell value in excel

I need to compute the range of a given cell in excel. For example, if the cell is like below,
Val
---
25
23
18
52
66
I need a formula to just find which range it belongs to. the ranges can be in intervals of 5 .. like 0-5,5-10,10-15 and so on. So desired output is
Val Range
-------------
25 21-25
23 21-25
18 16-20
52 51-55
66 66-70
Assuming A1 holds the value 25, then put this formula in A2:
=TEXT(CEILING(A1/5,1)*5-4,"0")&" - "&TEXT(CEILING(A1/5,1)*5,"0")
Copy it down to other rows as required

Index/Match values from a column using a grid of a different length (Excel 2010)

I am trying to index match values from a long column to a grid of a different length. It looks like this
Word Number Column X Column Y Column Z
This 55 55 33 12
is 62 62 42 18
The 78 78 31 24
42
31
12
18
24
33
The grid (Column X,Y,Z) contains all the values from the Number Column. What I am trying to do is basically index the "Word" column, using a value from the "Number" Column, and looking it up in the value array of X Y Z.
Example (because this is confusing):
Input the Value 33 from the Number column, look for the value in the columns XYZ, and then return the Word "This".
Input the Value 18 from the number column, look for the value in columns XYZ, return the word "is"
etc...
Any help would be very much appreciated!
there is a quicker way and shorter formula to do this:
=IFERROR(INDEX(A:A,IFERROR(MATCH(B2,C:C,0),IFERROR(MATCH(B2,D:D,0),MATCH(B2,E:E,0))),1),"not found")
paste that into, any column really, into row 2 and drag down, it will return the words you require, if value not found it will return "not found"
Here is your spreadsheet starting at cell A1 (without your headers):
A B C D E
1 This 55 55 33 12
2 is 62 62 42 18
3 The 78 45 31 24
4 42
5 31
6 12
7 18
8 24
9 33
10
11 Input: 24
12 Output: The
Copy this into cell C10, and drag the formula across to cell E10:
=IF(ISERROR(IF(ISERROR(IF(ISERROR(MATCH($B$11,C1:C3,0)),"",CONCATENATE("A",MATCH($B$11,C1:C3,0)))),"",INDIRECT(IF(ISERROR(MATCH($B$11,C1:C3,0)),"",CONCATENATE("A",MATCH($B$11,C1:C3,0)))))),"",IF(ISERROR(IF(ISERROR(MATCH($B$11,C1:C3,0)),"",CONCATENATE("A",MATCH($B$11,C1:C3,0)))),"",INDIRECT(IF(ISERROR(MATCH($B$11,C1:C3,0)),"",CONCATENATE("A",MATCH($B$11,C1:C3,0))))))
Copy this to the "output" cell B12 and use cell B11 as your "input":
=CONCATENATE(C10,D10,E10)
VIOLA!!! You're done!
Proof:
The MATCH() function will look for your value in an array (the range). If it finds it, it returns the index of that array (indexed at 1), otherwise it throws an error. Be sure to set the 3rd argument to "0" so that it only looks for EXACT matches.
Paste this into C14:
=MATCH($B$11,C1:C3,0)
Next, we check if the MATCH() function did indeed throw an error. Paste this into C15:
=IF(ISERROR(C14),"",C14)
Now we have the row number of our matched value, so we will use the CONCATENATE() function to join it to our "word column", A, for use in the next step. Paste this into C16:
=CONCATENATE("A",C15)
Using that string from above, use the INDIRECT() function to turn it into an actual cell reference. Paste this into C17:
=INDIRECT(C16)
And finally, check if a legitimate cell reference was created. If so, return the word, otherwise return "". Paste this into C18:
=IF(ISERROR(C17),"",C17)
Lastly, drag the formulas from C14:C18 to E14:E18, and concatenate the results. The cells in row 18 should match the cells in row 10.
Hope this helps :)

Resources