I have the following Excel spreadsheet:
A B C D E F G H
1 Q1 Q2 Q3 Q4 Search criteria: 60 Asset 2
2 Asset 1 15 85 90 70 Asset 3
3 Asset 2 40 80 45 60 Asset 3
4 Asset 3 30 60 55 60 Asset 5
5 Asset 4 12 72 25 15
6 Asset 5 60 48 27 98
7
In Cells A1:E6 I have different assets with their performance from quarter Q1-Q4.
In Column H I want to have a list of all assets that match the search criteria in Cell G1. In this case the search criteria is 60 which can be found in the Cells A1:E6 for the Assets 2, 3 and 5.
As you can see it can happen that the search criteria exists mutliple times in a row (like in Row 4). Therefore, I want that the asset is listed two times in the list (like Asset 3).
Do you have any idea of a formula that could create this list?
Try this in H1
=INDEX(A:A,AGGREGATE(15,7,ROW($B$2:$E$6)/($B$2:$E$6=$G$1),ROW(1:1)))
and copy down.
If you are using an older version of Excel this can be done with an array version of SMALL:
=INDEX(A:A,SMALL(IF($B$2:$E$6=$G$1,ROW($B$2:$E$6)),ROW(1:1)))
Being an array formula it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
Related
Need help regarding Excel dynamically search based sum of two columns matching from two different tables.
I have got this Table of Data Entered One Time
A B C
1 Qlty Warp Weft
2 Stpl.1 150 20
3 Cotn.1 80 60
4 Stpl.2 20 20
5 Cotn.2 20 20
6 Stpl.3 20 40
in Column A2:A6, Quality can not be duplicated, its a unique Name
The Data entry and report Table is here
A B C D E F
8 Yarn Name Sent Bags Remaining Qualty Used Warp Used Weft
9 20 800 600 Stpl.1 71 200
10 150 101 30 Stpl.2 70 30
11 40 300 290 Stpl.3 100 10
12 20 400
C9:C5000 is Returning Column, Values are calculated on the base of Column A9:A5000 (Yarn Name)
Need to Find Yarn Name (eg:) "20" in B2:B6 AND/OR C2:C6, wherever it matches, index that Quality from A2:A6
Then match the returned qualities(could be more than one) to D9:D5000 and sum the mathced results from E9:F5000
I have tried so far in C12
=SUMIF($A$9:$A12,A12,$B$9:$B12)-(SUMIF($D$9:$D12,INDEX($A$2:$A$6,MATCH(A12,$B$2:$B$6,0)),$D$9:$D12)+SUMIF($D$9:$D12,INDEX($A$2:$A$6,MATCH(A12,$C$2:$C$6,0)),$D$9:$D12))
PS:- I am using Excel 2007
If I understand correctly, then following array formula can help you:
=SUM(IFERROR(INDEX($A$2:$A$6,N(IF(1,(MMULT(--($B$2:$C$6=A9),TRANSPOSE(COLUMN($B$2:$C$6)^0))>0)*(ROW($B$2:$C$6))-1)))=TRANSPOSE($D$9:$D$12),0)*TRANSPOSE($E$9:$E$12+$F$9:$F$12))
Array formula after editing is confirmed by pressing ctrl + shift + enter
Edit:
To calculate Warp and Weft columns separately use following array formula:
=SUM(IFERROR(INDEX($A$2:$A$6,N(IF(1,((A9=$B$2:$B$6)*ROW($B$2:$B$6))-1)))=TRANSPOSE($D$9:$D$12),0)*TRANSPOSE($E$9:$E$12))+SUM(IFERROR(INDEX($A$2:$A$6,N(IF(1,((A9=$C$2:$C$6)*ROW($C$2:$C$6))-1)))=TRANSPOSE($D$9:$D$12),0)*TRANSPOSE($F$9:$F$12))
I have the following Excel spreadsheet:
A B C D E F G H
1 Q1 Q2 Q3 Q4 Asset 2 Q4
2 Asset 1 15 85 90 70 Asset 3 Q2
3 Asset 2 40 80 45 60 Asset 3 Q4
4 Asset 3 30 60 55 60 Asset 5 Q1
5 Asset 4 12 72 25 15
6 Asset 5 60 48 27 98
7
In Cells A1:E6 I have different assets with their performance from quarter Q1-Q4.
In Column F I currently list all assets that have a performance of 60.
As you can see it can happen that an asset is listed multiple times in Column F since it can have the same performance mulitple times in Cells A1:E6. In this case Asset 3 has a performance of 60 both in Q2 and Q4.
Now, I want that in Column G the quarters are automatically matched to each asset. Do you have any idea of a formula that could do this considering that an asset might be listed mulitple times?
If you want a formula, use this array formula
=INDEX($1:$1,SMALL(IF(($B$2:$E$6=$G$1)*($A$2:$A$6=H1),COLUMN($B$2:$E$6)),COUNTIF($H$1:H1,H1)))
Being an array formula it must be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
hard coded something things, and worked with the layout provided.
="Q"&AGGREGATE(15,6,COLUMN(INDEX($B$2:$E$6,AGGREGATE(15,6,(ROW($A$2:$A$6)-1)/($A$2:$A$6=F1),1),0))/(INDEX($B$2:$E$6,AGGREGATE(15,6,(ROW($A$2:$A$6)-1)/($A$2:$A$6=F1),1),0)=60),COUNTIF($F$1:F1,F1))-1
This does kind of cheat as it is concatenating the column number and the letter Q. For something that actually looks at your header and could be located anywhere the update formula could be:
=INDEX($B$1:$E$1,AGGREGATE(15,6,COLUMN(INDEX($B$2:$E$6,AGGREGATE(15,6,(ROW($A$2:$A$6)-ROW($A$2)+1)/($A$2:$A$6=F1),1),0))/(INDEX($B$2:$E$6,AGGREGATE(15,6,(ROW($A$2:$A$6)-ROW($A$2)+1)/($A$2:$A$6=F1),1),0)=60),COUNTIF($F$1:F1,F1))-COLUMN($B$2)+1)
I have the following Excel spreadsheet:
A B C D E F G
1 Q1 Q2 Q3 Q4 Positive values
2 Asset 1 -50 85 -90 70 85
3 Asset 2 -28 -80 -45 60 70
4 Asset 3 -30 50 55 -10 60
5 Asset 4 -20 5 -80 -15 :
6 Asset 5 35 -30 27 -98 :
7
In Cells A1:E6 I have different assets with their performance from quarter Q1-Q4.
In Column F I create a list of all postive performances of the assets using the formula from here:
Column F = {LARGE(IF($B$2:$E$6>0,B$2:$E$6),ROW(B1:E1))}
All this works fine so far.
However, now I want to exclude certain values from the list in Column F. For example I do not want that number 85 or number 70 appear in the list. Therefore, I tried to modify the formula to:
Column F = {LARGE(IF(AND($B$2:$E$6>0,$B$2:$E$6<>85,$B$2:$E$6<>70),B$2:$E$6),ROW(B1:E1))}
However, now I get 0 as result.
Do you have any idea of a formula that could solve this issue?
Create an array of 0's where 0 is equivalent to a negative number or the excluded values
($B$2:$E$6>0)*($B$2:$E$6<>85)*($B$2:$E$6<>70)
1/(… will convert that to 1's and errors
Multiply by the original to create an array of original values and errors
=1/(($B$2:$E$6>0)*($B$2:$E$6<>85)*($B$2:$E$6<>70)) * B2:E6
Use the aggregate function to get the results you want
=AGGREGATE(14,6,1/(($B$2:$E$6>0)*($B$2:$E$6<>85)*($B$2:$E$6<>70))*$B$2:$E$6,ROWS($1:1))
Fill down to get the 2nd, 3rd, etc largest
You are on the right path. Instead of using AND, a nested IF would work.
You need to create a new IF criteria for every new condition you want to test.
So if you want to exclude 85 and 70 you need to add two additional IF statements.
Formula for Column F would be:
={LARGE(IF($B$2:$E$6>0,IF($B$2:$E$6<>85,IF($B$2:$E$6<>70,B$2:$E$6))),ROW(B1:E1))}
You can read here how the formula process is: Minimum if multiple criteria
If you have data in column F and you want to extract all values that are not 70 or 85 into column G, then in G2 enter:
=IFERROR(INDEX(F$2:F$9999, AGGREGATE(15, 6, ROW($1:$999)/((F$2:F$9999<>85)*(F$2:F$9999<>70)), ROW(1:1))),"")
and copy downwards:
Note that this approach does not require the use of an array formula.
I have a form, thanks to user JamTay317, That lists data depending on folder number (bold number in form). I need to copy it for all 1500 folders (about 400 pages)
Form is divided on 4 labels on a page for easier printing
form overview
Form get it's folder number (nr teczki) from list with all folders from another sheet called "lista teczek":
list of folders
For first 4 folder numbers I use formula:
A2='lista teczek'!A1
J2='lista teczek'!A2
A21='lista teczek'!A3
J21='lista teczek'!A4
When I copy whole page underneath it increments by 36 (number of rows between)
A38='lista teczek'!A37
J38='lista teczek'!A38
A57='lista teczek'!A39
J38='lista teczek'!A40
Instead of A5, A6, etc.
Is there any way to override excel's incrementation to force it to use consecutive numbers? Or at least formula which will make it easier to follow folders list?
So I would use offset() to get the correct position
=A2=OFFSET('lista teczek'!$A$1;ROW(A1)-INT(ROW(A1)/36)*36+4*INT(ROW(A1)/36)-1;0)
So this will offset from A1 in the list sheet.
Below are row numbers a resultant lookup row numbers
Note the formula I used in the offset has an extra "-1" as this is an OFFSET so to get 1 from 1 we need to offset by 0
1 1
2 2
3 3
4 4
37 5
38 6
39 7
40 8
73 9
74 10
75 11
76 12
109 13
110 14
111 15
112 16
145 17
146 18
147 19
----LOGIC--- (edit)
So the idea is that you work out the occurrence you are on. Int(row()/36) gives us this. For example
int(1/36)=0
Int(363/36)=10
First part gives us the offset from the start of the occurrence
3-int(3/36)*36=3
378-Int(363/36)*36=3
Second part give the total of the previous occurrence
4*int(3/36)=0
4*Int(363/36)*36=40
So you need to change the 36 to the gap between the occurrences and the 4 to the length of occurrences Not sure if that helps to explain
I'm trying to pair a vlookup with a max function. For some reason it only returns #ref every time I try to use it though.
My sheet looks like this:
A - B - C - D - E - F - G
1...
5 - Prod5 id1 $100 $125 $155 $110 $150
6...
A:G is named buyAverages
C:G is named buyAveragesPrices
What I want to do is have a vlookup go and find a value in Col A and then return the highest value in that Col. So example:
A - B
1 - Prod5 *return highest price for Prod5
What I wrote in B1, which failed:
VLOOKUP(A1,buyAverages,MAX(buyAveragesPrices))
So how do I achieve this lookup? Everything I have found is how to use MAX for the lookup value, but nothing to use max on the returned index.
Try this
=MAX(IF(A:A="Prod1",C:G))
This is an Array Formula. i.e you have to press Ctrl+Shift+Enter
If there's only one instance of each Product then you can use INDEX/MATCH like this
=MAX(INDEX(C2:G100,MATCH("Prod 1",A2:A100,0),0))
Longer than Sid's suggestion but doesn't need CSE and might be more efficient if you only have a single match
If you have that formula in Z2, for example, you can use this version to get the location from row 1
=INDEX(C1:G1,MATCH(Z2,INDEX(C2:G100,MATCH("Prod 1",A2:A100,0),0),0))
You can have all in one cell using Vlookup and Max with a nested formula. For example at the top of the page:
A1 = Select the name of the product you want to find the max
A2= MAX(BUSCARV($A$1;$A$3:$F$11;3;FALSO);BUSCARV($A$1;$A$3:$F$11;4;FALSO)
;BUSCARV($A$1;$A$3:$F$11;5;FALSO);BUSCARV($A$1;$A$3:$F$11;6;FALSO))
It's long but you only have to type it once. With this formula we get all the different amounts in each column and then we ask for the maximum. It works if all the products are different. Change the name of the product and you'll find the MAX in the table.
Example Prod8
Prod8 41 ; If we change and you select in A1 Prod4 you'll
get 70 and so on..
Prod1 id1 100 125 155 110
Prod2 50 25 20 75
Prod3 60 65 15 90
Prod4 70 12 50 43
Prod5 100 200 80 25
Prod6 20 28 40 40
Prod7 14 43 60 80
Prod8 22 33 15 41
Prod9 65 48 50 70
Select your range accordingly.
You also could include in A1 a match code to select the name of your products..