I have a table in excel file, please have a look on below image:-
I want to know the position of cell which has minimum value.
As you can see cell AE26 has the minimum value.
I am trying below formula :-
=CELL("ADDRESS",INDEX(Z7:AJ26,MATCH(MIN(Z7:AJ26),Z7:AJ26,0)))
But it is giving "#N/A" :- "A value is not available to the formula and function."
Not sure what I am doing wrong.
You can't use Match() on a multi-column range.
Your scenario can work if you use a helper column and a helper row to identify which row and which column holds the smallest value of the table.
Consider the following screenshot:
The conditionally formatted table has the defined name MyTable.
Cell D1 calculates the minimum value in the table with the formula
=MIN(MyTable)
D1 has the range name SmallNumber.
Cell I3 has the following formula, copied down
=IF(ISNUMBER(MATCH(SmallNumber,B3:H3,0)),TRUE,FALSE)
Cell B15 has the following formula, copied across:
=IF(ISNUMBER(MATCH(SmallNumber,B3:B14,0)),TRUE,FALSE)
The intersection of the "TRUE" values is the location of the smallest number in the table. If you want to return the cell address of that, you can use the formula in cell D2
=CELL("address",INDEX(MyTable,MATCH(TRUE(),I3:I14,0),MATCH(TRUE(),B15:H15,0)))
You can see a sample file here.
Related
I have a matrix dataset with values in Excel, where row and column names are identical. I have put all matrix values in a single column, but would now like a formula that returns the matching row name and/ or column name for that value. I have tried VLOOKUP and versions of INDEX and MATCH, but can't get it to work.
Here's an illustration of the data:
Setup:
Source table range A1:D4
Values populated in column H for checking.
Formula in cell F2:
=IFERROR(INDEX($A$1:$A$4,MIN(IF($B$2:$D$4=H2,ROW($B$2:$D$4),10^10))),"")
Formula in cell G2:
=IFERROR(INDEX($A$1:$D$1,1,MIN(IF($B$2:$D$4=H2,COLUMN($B$2:$D$4),10^10))),"")
Depending on your version, you may have to use CTRL+SHIFT+ENTER to implement these formulas. Output will be like below.
You are not looking for a rowname or a columnname, you are looking for the content of the first row or column:
Imagine you want to know the "columnname" of cell "C4", then you just ask for Cell(3,1) (3 meaning "C").
Imagine you want to know the "rowname" of cell "C4", then you just ask for Cell(1,4).
I want to use the match function in Excel the following way: match(True, D2:J2>=K1,0), to find the smallest value that is greater than or equal to lookup_value. My problem is how to change the row number in the array, since the row number is on his part the result of a match function.
Thanks for the help in advance!
Your baseline formula is:
=MATCH(TRUE,D2:K2>=K1,0)
which looks at row #2:
To change that row, lets put 7 in cell A1 to mean use row #7. We change the formula to:
=MATCH(TRUE,INDEX(D:D,A1):INDEX(K:K,A1)>=K1,0)
So the value in A1 defines the row that MATCH() should use.
EDIT#1:
Here is another example of using INDEX() to return a cell reference.
Say we have data in column A. We want the user to be able to select parts of the column (start and stop rows) and sum the part. However, we don't want the user to tinker with the formula. In fact we are going to lock the formula cell so the user can't destroy the formula. We tell the user to put the start row in D1 and the end row in D2.
We put the formula in cell D3:
=SUM(INDEX(A:A,D1):INDEX(A:A,D2))
I have a simple formula in cell B7 of a sheet called Summary Stats that references a sheet called Rolling Returns Data:
=COUNT('Rolling Returns Data'!C$11:C$17202)
I want to be able to dynamically reference the column in the formula i.e. I have letter C in cell B1 of the Summary Stats sheet and want to be able to replace the reference to column C in the formula with a reference to cell B1, so that if I then change the formula that calc. that is then being performed is:
=COUNT('Rolling Returns Data'!D$11:D$17202)
As Scott Craner suggested, use INDIRECT.
=COUNT(INDIRECT("'Rolling Returns Data'!"&A1&"$11:"&A1&"$17202"))
Now you just have to put the letter of the column you want to reference. You can of course change the A1 reference to anything you'd like. Or you can change the code to the following
=COUNT(INDIRECT("'Rolling Returns Data'!"&A1))
and use A1 to specify the address of your column, in this case "C$11:C$17202".
If you're ok using column numbers rather than column letters then this non-volatile formula will work:
=COUNT(INDEX('Rolling Returns Data'!1:17202,11,$B$1):INDEX('Rolling Returns Data'!1:17202,17202,$B$1))
If you really want to use column letters then you can turn a column letter into a column number using:
=COLUMN(INDIRECT($B$1 & 1))
But then you lose the non-volatile nature.
Edit:
If you use the column numbers and leave B1 blank it will return the count of all columns.
To return a value corresponding to another cell from a range if it matches with a cell, I found Chuff's solution helpful (in
Excel - match data from one range to another and get the value from the cell to the right of the matched data ):
=iferror(vlookup(b31,$f$3:$g$12,2,0),"")
However, if there are more than one cells within the column F which match with b1, the formula returns the value of only one cell from the column G.
Could it be modified so as to attract the value of more than one cell?
Thank you!
To return multiple corresponding Vlookup values you should use this formula: =IFERROR(INDEX($B$2:$B$9,SMALL(IF($E1=$A$2:$A$9,ROW($A$2:$A$9)-ROW($A$2)+1),COLUMN(A1))),"")
Because it it an array formula, please enter it using combination of CTRL+SHIFT+ENTER . For example, if you have you lookup range in A:B column, and lookup values in D column, then please enter formula above to F1 cell, then drag it to the right and to the bottom. You should now see all instances of Vlookup next to the lookup value in D column.
If you have only values which you want to sum in case they correspond to your value in cell B31, then simply use SUMIF formula like this =SUMIF($F$3:$F$10,$B31,$G$3:$G$10) entered in cell C31.
I have a 2 column table with corresponding values. I want to a cell to detect values from one column and return value from the corresponding column. I can use "if" function but it would be too big of a function is there any other option. Note: I am using Excel 2013
Considering data is in Range A2:B15, values to match are in Column D and output should be displayed in Column E. Then in Cell E2 enter the following formula:
=VLOOKUP(D2,$A$2:$B$15,2,FALSE)
Drag/Copy down as required. Change A2:B15 with your data range. See image for reference.