So say I have a sheet like the following:
Row 1 2 3 4 5 6
1 x
2 x
3 x x
4 x
5 x x
6 x
And I have another sheet which I want to encapsulate the data with:
1st appeared
1
2
1
4
2
6
I'm basically trying to construct the second sheet. Is there a way for each row to start at column two and go up to the ith column and display where the first 'x' appears. (Note that we can assume that every row will have at least 1 'x' when the row and column meet forming a diagonal down the entire first sheet) [Note that my first spreadsheet is roughly 5,000 x 5,000 hence why I'd like a nice formula for this instead of doing things by hand =)]
Thanks in advance!
The MATCH function return the relative position in either a row or column. Use this formula in your second worksheet.
=iferror(match("x", sheet1!1:1, 0) - 1, 0)
Fill down to retrieve the correct column index or zero if not found. A 1 is subtracted since hte want the position relative to column B. The IFERROR function return a default 0 is no match is found. Substitute "" in place of the zero if you want nothing displayed.
Related
There are 50 rows. The first column (A), each row has has a ID number. They are not sorted in any way and should not be either and there are no duplicated ID numbers. When the ID is 0 then consider 4 rows before that row, take the mean value of those values in clumn C between those 4 rows. If it helps It is always the last row that has value ID = 0.
What I have done so far is that I can find the ROW number of the ID = 0 using the following formula:
ROW(INDEX(A3:A53,MATCH(TRUE,INDEX(A3:A53=0,),0)))
Now I don't know how to navigate 4 rows upwards and take the corrosponding values in Column C.
If you use an extra column (say column Z), then paste this code into that column starting on row 4 (NB it won't work properly for the first 3 rows because there are not 4 above to check).
=IF($A4 =0, AVERAGE($C1:$C4), "Not Relevant")
so put that code in Z4, then press ctrl+E to flash fill it downwards.
Hopefully, on each line where the ID is 0, there will be an average of that line and the previous 3 in column Z on that row.
Use:
=AVERAGE(INDEX(A3:A53,MATCH(TRUE,INDEX(A3:A53=0,),0)-5):INDEX(A3:A53,MATCH(TRUE,INDEX(A3:A53=0,),0)-1))
I need a formula that looks for a value in column A, finds the smallest value of that row and displays the corresponding value of a row on the top of the sheet (row 3 in my case) where the smallest value has been found.
also would like to find the second and third smallest value and display the value of row 3.
For example: I need to lookup X in the first column, find the smallest value in that row (1) and display the value on the row on top of that column (D)
and second smallest value for X to display C, third smallest for X to display E.
enter code here
A B C D E F
Z 6 8 9 5 2
X 7 2 1 3 7
Y 9 2 6 1 6
This codes should work:
=INDEX($B$2:$F$2,MATCH(MIN(IF($B$1=$A$3:$A$5,$B$3:$F$5)),INDEX($B$3:$F$5,MATCH($B$1,$A$3:$A$5,0),),0))
!https://imgur.com/2YFu39E
Suppose your data are in range A1:F4 as shown below:
You can use the following formula to find the 1st, 2nd and 3rd smallest value in the row starting "X". Put it in Cell I2 and drag it down.
=SMALL(INDEX($B$2:$F$4,MATCH("X",$A$2:$A$4,0),),H2)
Then you can use the following formula to find the corresponding value in the row starting "Z":
=INDEX(INDEX($B$2:$F$4,MATCH("X",$A$2:$A$4,0)-1,),,MATCH(I2,INDEX($B$2:$F$4,MATCH("X",$A$2:$A$4,0),),0))
It is basic INDEX+MATCH approach. If you have problem understanding the solution, I suggest you to google some online tutorials on the use of INDEX+MATCH. SMALL function is used to find the nth smallest value as requested.
Cheers :)
I have a table that looks something like this:
Column A | Column B
A 1
B 2
C 3
A 4
What I want to do is get the sum of the values in Column B, but only first the first occurrence of each value in Column A. Thus, the result I want to get is (1 + 2 + 3) = 6 (Adding the first three rows, but omitting the fourth, because a row with 'A' in Column A has already included in the sum).
I've tried looking at Frequency, but I haven't been able to figure out how to use it properly to get the result I want.
Use SUMPRODUCT and MATCH:
=SUMPRODUCT(--(ROW(A1:A4)=MATCH(A1:A4,A:A,0)),B1:B4)
I have a dataset in Excel and I want to compute a formula for deviation from mean agreement.
Suppose the dataset is like this:
A B C D E
4 2 6 9
1 3 2
7 2 1
8 4 3
5 1 2
What I want to calculate has formula as (summation from i=1 to 5 (i.e., from A to E) |R-R'|/t)/N where N = 4 for 1st row, N = 3 for 2nd row and so on that is, no. of non null values for that row. R is current value in the row and R' is mean of the column for which we are considering R and t is no. of non null values in that vertical or column.
You will need to use the ABS() function to get the absolute value of the subtractions. To get the number of non-null cells you can use the COUNT() function. To only include items in a row that are not null you can use an IF() statement.
For example, if you data was in the range A1:E5 then the following formula would get the result for the first row if I've understood the calculation you are doing correctly:
=(IF(LEN(A1)>0,(ABS(A1-SUM(A$1:A$5))/COUNT(A$1:A$5)))+IF(LEN(B1)>0,(ABS(B1-SUM(B$1:B$5))/COUNT(B$1:B$5)))+IF(LEN(C1)>0,(ABS(C1-SUM(C$1:C$5))/COUNT(C$1:C$5)))+IF(LEN(D1)>0,(ABS(D1-SUM(D$1:D$5))/COUNT(D$1:D$5)))+IF(LEN(E1)>0,(ABS(E1-SUM(E$1:E$5))/COUNT(E$1:E$5))))/COUNT($A1:$E1)
Which results in 2.4853 for row 1
***1 2 3***
a 2 3
b 3 4
c 4 3
d 5 2
so I know to get the highest value I do
=INDEX(column1, MATCH(MAX(column3), column3, 0))
... which would give me 'b'
now I want to get the second highest value based on the column 3 but because there are two cells with 3 (which is the second highest value) I want to use the one that has the lowest value in column 2 based on those two rows. Is this possible?
Use a 'helper' column that adds column C + (column B ÷ 10) and use a modification of your original formula on that column.
The standard formula in F5 is,
=INDEX(A$2:A$5, MATCH(AGGREGATE(14, 6, D$2:D$5, ROW(1:1)), D$2:D$5, 0))
Fill down as necessary.