Make formula for list of row names independent from entire column and first row - excel

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 list 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.
For creating the list I use the formula from here:
=INDEX(A:A,SMALL(IF($B$2:$E$6=$G$1,ROW($B$2:$E$6)),ROW(1:1)))
All this works fine so far.
Now when I move the Cells A1:E6 in the sheet for example to D9:H14 the array formula keeps only working if it still refers to A:A and ROW(1:1) which might be a problem if the user decides to delete ROW(1:1). Therefore, I tried to modify the formula to:
=INDEX($D$9:$D$14,SMALL(IF($E$10:$H$14=$J$10,ROW($E$10:$H$14)),ROW($D$9:$H$9)))
However, with this modification I get #NUM! error.
Do you have any idea if it is possible to make the array formula independent from A:A and ROW(1:1) so it refers only to the Cells A1:E6 and automatically moves when the those cells are moved?

If you use excel 2013 or later then you can use following formula.
=IFERROR(INDEX($D$10:$D$14,AGGREGATE(15,6,ROW($1:$5)/($E$10:$H$14=$J$10),ROW(1:1))),"")

You can limit A:A to A1:A6 so that it would adjust as necessary when you move it. Your formula should thus be now
=INDEX(A1:A6,SMALL(IF($B$2:$E$6=$G$1,ROW($B$2:$E$6)),ROW(1:1)))
As for ROW(1:1), your top formula should always be ROW(1:1) and when you drag it down, then next formula should have ROW(2:2). When you move your top formula somewhere else and the ROW(1:1) changes to something like ROW(9:9) or anything, change it to ROW(1:1).
Please note that 'moving' your formula is different from 'dragging it down'.
EDIT:
So after you moved your data set, the top formula should now be:
=INDEX($D$9:$D$14,SMALL(IF($E$10:$H$14=$J$10,ROW($E$10:$H$14)),ROW(1:1)))
This is assuming that cell G1 (criteria) is also moved to J10.

Related

Find column and row name based on search criteria

I have the following Excel spreadsheet:
A B C D E F G
1 Q1 Q2 Q3 Q4 Search criteria: 60
2 Asset 1 15 85 90 70 Column name: Q4
3 Asset 2 40 80 45 60 Row name: Asset 2
4 Asset 3 30 50 55 10
5
In Cells A1:E4 I have different assets with their performance from quarter Q1-Q4.
In Cell G2 and G3 I want that the assets and the quarter are displayed based on the value that is put in Cell G1. In this case the search criteria is 60 so the result is column name Q4 and row name Asset 2.
With VLOOKUP or INDEX & MATCH I would only be able to find the the value 60 based on the criterias in Cell G2 and G3 but not the other way around like I need it.
Do you have any idea of a formula that could solve this issue?
NOTE: All values in the table are unique.
You could use something like this (entered as array formulas using Ctrl+Shift+Enter)
Try the following...
G2:
=INDEX(B1:E1,MATCH(G1,INDEX(B2:E4,MATCH(G3,A2:A4,0),0),0))
G3, confirmed with CONTROL+SHIFT+ENTER:
=INDEX(A2:A4,SMALL(IF(B2:E4=G1,ROW(A2:A4)-ROW(A2)+1),1))

Excel horizontal list to columns

I am looking to format some data. To make it more easy I use an example with simple numbers.
Sheet 1 ('S1'):
A1 10
A2 14
A3 23
A4 12
A5 64
A6 32
.... etc
It is a long list(vertical) of 600 values
Now I want in Sheet 2('S2'):
To show it as:
S1!A1 S1!A2 S1!A3 S1!A4 S1!A5 S1!A6
S1!A7 S1!A8 S1!A9 S1!A10 S1!A11 S1!A12
S1!A13 S1!A14 S1!A15 S1!A16 S1!A17 S1!A18
References to the cells in the other sheet.
I have tried to transpose them but I cannot find a modifier to set an amount of columns used. i.e. I would get 1 row with all my data. I want only the first 6 in row, next 6 in next row, next 6... etc.
Thanks for any help/feedback given.
Put this in the upper left cell desired:
=INDEX(Sheet1!$A:$A,(ROW(1:1)-1)*6+COLUMN(A:A))
Then copy/drag over 6 columns and down till you finish the list
Sheet1

Excel - Remove duplicates and SUM at the same time

I have a column with ID's, but they are duplicated; for instance:
"0,0,1,1,1,2,3,3,4,4, ... "
For each row, I have a given value in the other columns, for instance:
"0-24; 0-36; 1-13; 1-34; 1-23;..."
I want to keep only one row with each ID but I need to sum the values of each ID, that is, sum all the values in all columns for a given ID (0,1,2,...), which may include several rows.
Is there a easy way to do this using Excel?
Here is some sample data (table to the left) together with the desired output (tables to the right).
ID Value ID Value
0 24 0 60
0 36 1 70
1 13 2 16
1 34 3 24
1 23 4 48
2 16
3 9
3 15
4 24
4 24
What you can do is to copy your IDs and paste them for example in another Sheet. Let's assume your original table is in Sheet1, and you copy all your IDs to column A in Sheet2.
Then you remove duplicate IDs in Sheet2:
Select column A > Data Ribbon > Data Tools > Remove Duplicates
In column B, you then put the formula:
=SUMIF(Sheet1!$A:$A, Sheet2!$A2, Sheet1!$B:$B)
Note: above formula goes into cell B2 on Sheet2, and you copy it down with pasteSpecial > only formulas.
Edit: if you still want the same number of rows etc because of the information in your other columns, just skip the "Remove duplicates"-part.

Send data (Job #) in one column to another spreadsheet, if another column contains data

Here is a sample of the data I'm using. The letters are the estimated time in each area of the workshop (i.e. A. is clean up, B. is welding etc.):
J/C # A. B. C. D. E. F. G. H. TOTAL
97647 45 45 90 30 120 330
97651 15 30 45
97626
99999 60 120 75 360 615
11111 90 30 15 15 150
12345 10 20 30 40 50 60 70 80 360
On another sheet I need a column of all the Job Card numbers (J/C #) for each workshop area. I would like these automatically to appear when the budgeted time is put into this first sheet.
For example the Welding Sheet will have the following J/C #.
97647
99999
12345
I have been trying INDEX and MATCH and LOOKUP and VLOOKUP functions, but haven't yet found a solution.
Is this possible?
I have a solution that works -- hopefully I can explain it clearly.
Let's say your table is on "Sheet1". Create new sheets, one for each workshop (so, I have a "Sheet1", "A","B","C",...,"H").
In your "A" sheet, put this formula in A1:
=IFERROR(INDEX(Sheet1!$A$2:$A$10000,SMALL(IF(Sheet1!B$2:B$10000<>"",ROW(Sheet1!A$2:A$10000)-ROW(Sheet1!A$2)+1),ROWS(Sheet1!A$2:A2))),"") Enter with CTRL+SHIFT+ENTER and drag down.
This will create a population of those Job #s that have some value under the "A." column in "Sheet1".
To use this formula for your "B." column, put this formula in sheet "B", cell A1:
=IFERROR(INDEX(Sheet1!$A$2:$A$10000,SMALL(IF(Sheet1!C$2:C$10000<>"",ROW(Sheet1!A$2:A$10000)-ROW(Sheet1!A$2)+1),ROWS(Sheet1!A$2:A2))),"")
Notice the only change is in the "SMALL(IF(Sheet1!C$2:C$10000<>..." That's because since you want to return any job numbers for your "B." column, which is in Column C of Sheet1. ...so for your "C." Sheet, in A1, put the above formula but using column D for the "Small(If(Sheet1!C$2:C$10000" part.
Does this make sense?
The only thing is that you'll need to tweak depending on your sheet names (since I don't know what C,D,E, etc. actually refer to).

Nested IF Excel formula

I am currently using the following formula i.e. =IF(COUNTIF($A$1:A2,A2)>4,A2+1,A2) to change the number when I drag this formula downsdie of the rows.
For Example: in this case for every five rows number will change i.e. A1 to A5 it will 1 and A6 to A10 it will be 2 and A11 to A15 it will be 3 etc.
Just wanted to know is it possible to extend the same formula, so along with adding 1 number for every five rows it should also skip 2 numbers for every 60 rows.
For Example: if the 60 row is number 12, then 61st row should be 15 and 120 row will be 26 and 121 row should be 124 etc.
Can someone please help me with this formula?
Thanks for your help in advance.
Number starts at one.
Then get the cell's row number and subtract one. Divide that number by 5 and discard the fractional part (or the remainder). So numbers from 0 to 4 (which are rows 1 through 5) all get an increment of 0, 5 to 9 get 1, and so on. Similar logic with multiples of 60 except that the counting is doubled.
=1 + floor((row()-1)/5, 1) + floor((row()-1)/60, 1) * 2

Resources