Excel index match equal or greater than value error - excel

hello first of all this is my code which returns the error
=INDEX(Steel_table!A3:A151,LOOKUP(10^10,MATCH(H7,Steel_table!C3:C151,{1,0})+{1,0}))
i have based this code from this thread:
Use INDEX MATCH to find greater than/equal to value
This is the scenario
i have 2 sheets namely, stress analysis and steel table
the value that i would like to compare is located in the stress analysis sheet cell H7 and i would like to compare it to the steel table sheet from cell's values from C3 until C151.
please help me as it always returned an #N/A error
Stress Analysis Sheet
Steel Table sheet
Many thanks

The use of third argument to MATCH functions must be considered depending on whether the lookup range is sorted or not.
The only time the range sort need not be taken into account is when using 0 - exact match. But exact match is not what you need since you are looking up calculated results against a table of prefixed values which won't likely be exactly matched...
So in order to use third argument of 1, the looking range should be sorted in ASCENDING order. In your case teh second value of the lookup range is larger than your lookup value, and so is the first, so Excel shortcuts to N/A, assuming that no smaller value will be found further down.
The reverse logic is true for using -1.
You can simply use the difference of the lookup values and the range to obtain the smallest one. So we use the MIN function. But you only want positive differences , so you'll need to transform all negative numbers into a ridiculously large number(such as 10^10), so that they are not used as potential minimum values:
INDEX(Steel_table!$A$3:$A$151, MATCH(MIN(IF(Steel_table!C3:C151-H7>=0, Steel_table!C3:C151-H7, 10^10)), Steel_table!C3:C151-H7,0))

This will give you the smallest value in Steel_table!C3:C151) that is equal or greater then the value in cel H7:
=MIN(IF((Steel_table!C3:C151)>=H7,(Steel_table!C3:C151)))
It is an array formula, so confirm with [Control-Shift-Enter]. The output will be 1451.61. It will return 0 when there is no equal or greater value.

Related

Search for the first positive value cell after the highest negative value in Excel

I have a range of cells with cash flow values some are positive and some are negative within different ranges.
I am trying to find the cell that contains the highest negative value and search for the next positive value after it.
Here is an example of the rage of cells:
I am trying to get the value of the $627,744
Here is what I have started thinking of:
=min(a1:f1)
but I am not sure if it is possible to set a logic to extract the next positive value.
You can try this formula
=INDEX(A1:F1,
MATCH(1,--(INDEX(A1:F1,MATCH(MIN(A1:F1),A1:F1,0)):F1>0),0)
MATCH(MIN(A1:F1),A1:F1,0)-1
)
This part
INDEX(A1:F1,MATCH(MIN(A1:F1),A1:F1,0)):F1
builds a variable range starting from the min-value (the INDEX-part) to the last value of the list (F1 in this case).
This variable list is compared to 0.
The --()-part converts the TRUE/FALSE-list to a 1/0-list.
The surrounding MATCH finds the position of the first 1 (value greater zero).
Then the position of the smallest value is added
MATCH(MIN(A1:F1),A1:F1,0)
Finally the overlapping range-part needs to be subtracted -1.
I hope this explanation is somewhat helpful. For further information i would refer to the formula evaluation-tool.

What function can I pass to determine the point score in Excel?

I am trying to calculate the point score for which matches the findings column from the data. There are many different sections since there are different categories within the data. What kind of forumla could I use to determine the score based on the different categories? I considered use vlookup but that only works for the first section of the point data.
The objective is to return either 0,1 or 2 based on the category of the data such as media and the finding values
Excel Data
You can use a combination of INDEX, MATCH and OFFSET, with a helper row:
For formula I'm using there is as follows:
=INDEX(OFFSET(INDEX($A$2:$A$12,MATCH(C18,$A$2:$A$12,0)),3,1,1,3),MATCH(B18,OFFSET(INDEX($A$2:$A$12,MATCH(C18,$A$2:$A$12,0)),2,1,1,3),1))
OFFSET(INDEX($A$2:$A$12,MATCH(C18,$A$2:$A$12,0)),3,1,1,3) this part gives the range for points matching the category. I use something similar to get the range matching the points.
First, INDEX and MATCH gives the cell containing the category. I use OFFSET to move that reference 3 cells down, 1 cell right, keep the height and increase the width to 3. For instance, in D2, INDEX and MATCH gives me cell A7. Offsetting that using the values I mentioned earlier means that the result of offset will be the range B10:D10.
Using the same logic, I get the range B9:D9. From that range, I use MATCH to get the highest column in which the value in range B9:D9 is smaller than the listing value, in this case the value 100 is the largest value that is smaller than 165, so I get the result 3 from MATCH. This fed into INDEX gives the corresponding points.
But you can do without OFFSET if you can picture the different arrays in your head using only INDEX and MATCH:
=INDEX($B$5:$D$15,MATCH(C18,$A$2:$A$12,0),MATCH(B18,INDEX($B$4:$D$14,MATCH(C18,$A$2:$A$12,0),0),1))

Excel - Find first value in a range that is =< 0 and return the date

So im making an excel spreadsheet and I have a scenario in which I am trying to forecast out some values and I need to use a combination of formulas that will help me find the first value that is less than or equal to 0 from the range of values in the row and return the date above. I have included a screen shot of what i am talking about. Any help is greatly appreciated.
It looks like the data in row 3 is sorted descending, so Match() can be used with -1 as the third parameter. With that, though, Match returns the smallest value that is greater than or equal to the lookup value, so, if there is no 0 in the range, the next cell to the LEFT is returned, which is not what you want.
Therefore, the formula must first find the matching value, then test if it is 0 or less, and if not adjust the returned Match value by 1.
This leads to
=IF(INDEX(B3:G3,MATCH(0,B3:G3,-1))<=0,INDEX(B1:G1,MATCH(0,B3:G3,-1)),INDEX(B1:G1,MATCH(0,B3:G3,-1)+1))

4 variables index function, with great than and less than for 2 variables

I am trying to use index match functions to determine the appropriate rate for the below table.
So for example a consumer loan that is for a person that owns property, the car is 2 years or less in age and the total loan to value ratio is less than 140% should return a value of 5.15%
I believe this is what you wanted...
I would use a series of nested if functions to evaluate which column of LTV I would want the value to come from.
"That is what is done in the AND( ) part. If the value is greater than the 110% and smaller than 140% let's do the Index Match on the 110% Column, Otherwise do it on the 140% Column."
You could extend this for more columns with more IFs in the false condition.
Then it is a simple INDEX match with concatenation. It searches for the three parameters all concatenated in a single range of concatenations.
Hope it helped.
Proof of Concept
In order to achieve the above I had to make a minor edit to your header to be able to distinguish between the two 140% columns.
The functions used in this answer are:
AGGREGATE function
MATCH function
INDEX function
ROW function
IFERROR function
I placed the main part of the formula inside the IFERROR function as a way of dealing with things that may be out of range or when not all the input have been provided. I then assumed that what you were basing your search on would be provided in a series of cells. In my example I assumed the questions would be asked in the range H3 to K3 and I place the results in L3.
The main concept is centered around the INDEX function. I specified the index range as being the height of your table and the width of the percentage rates. Or for this example D2:F9.
=IFERROR(INDEX($D$2:$F$9,row number, column number),"Not Found")
That is the easy part. That more challenging part is determining the row and column number to look in. Lets start with the column number as it is the slightly easier of the two. I assumed the ratio to look for, or rather the header of the column to look in would be supplied. I basically used this equation to determine the column number:
=MATCH(K3,$D$1:$F$1,0)
which in layman's terms is which column between D and F, counting column D as 1, has the value equal to the contents of K3. So now that there is a formula to determine the column, we can drop that into our original formula and wind up with:
=IFERROR(INDEX($D$2:$F$9,row number,MATCH(K3,$D$1:$F$1,0)),"Not Found")
Now we just need to determine the row number. This is the most complex operation. We are going to basically make a bunch of logical checks and take the first row that matches all the logical checks. The premise here is that a logical check is either TRUE or FALSE. In excel 0 is false an every other integer is TRUE. So if we multiply a series of logical checks together, only the one that is true in all cases will be equal to 1. The first logical check is the loan type. it will be followed by the living status and then the vehicle age.
=(H3=$A$2:$A$9)*(I3=$B$2:$B$9)*(J3=C2:C9)
now if you put that into an array formula you will get a series of true false or 1/0. We are going to use it inside an AGGREGATE function with a special feature. The AGGREGATE function will perform array like calculation for some of its functions. We are going to use function 15 which will do this. We are also going to tell the aggregate function to ignore all errors, which is what the 6 does. So in the end what we wind up doing is dividing each row number by the logical check. If the logical check is false or 0, it will generate a Div/0! error which aggregate will choose to ignore. In the end we wind up with a list of row which match our logical check. We then tell the aggregate that we want the first result with the ,1. so we wind up with a formula that looks like:
=AGGREGATE(15,6,ROW($A$2:$A$9)/((H3=$A$2:$A$9)*(I3=$B$2:$B$9)*(J3=C2:C9)),1)
While this does provide us with the row number we want, we need to adjust it to make it an index number. In order to do this you need to subtract the number of header rows. In this case 1. So the index row number is given by this formula:
=AGGREGATE(15,6,ROW($A$2:$A$9)/((H3=$A$2:$A$9)*(I3=$B$2:$B$9)*(J3=C2:C9)),1)-1
And when we substitute that back into the earlier equation for the row number, we wind up with the final equation of:
=IFERROR(INDEX($D$2:$F$9,AGGREGATE(15,6,ROW($A$2:$A$9)/((H3=$A$2:$A$9)*(I3=$B$2:$B$9)*(J3=C2:C9)),1)-1,MATCH(K3,$D$1:$F$1,0)),"Not Found")

Excel - Cell left of the median cel

I have an array in excel: C2:C20. I want to find the cell with the median and then find the value of a cell in column A corresponding to the row. Some of the cells in the array might not contain anything. How do I do that?
EDIT:
The table is about observations.
The A column is about the name of the observation.
Sorry for the Danish language.
Hyppighed = frequency
Summeret hyppighed = summerized frequency
Sample table:
Result table when using the suggested functions
This will return the first median value found in C2:C20 and return the corresponding cell in column A.
=INDEX(A2:A20,MATCH(MEDIAN(C2:C20),C2:C20,0),1)
If you know exactly what you are looking for you can replace MEDIAN(C2:C20) with whatever you are searching in the Array contained in column C. If it is a string you are searching use "" around your text.
EDIT:
The reason you are getting N/A with your data set is because there is no exact match to the Median. In order to resolve this you need to replace the 0 with a 1 if you want a value higher than or equal the median or -1 if you want a value lower than or equal to the median.
Try this and it will give you the next highest median value if there is no match.
=INDEX(A2:A20,MATCH(MEDIAN(C2:C20),C2:C20,1),1)
For the purposes of doing an index look up the above method using the median function is inferior,
barry houdini made a great suggestion below which will choose the median value available or the next lowest one regardless of sorting...
=INDEX(A2:A20,MATCH(SMALL(C2:C20,INT((COUNT(C2:C20)+1)/2)),C2:C20,0))
or alternatively if you wanted to choose the highest one if the median is not available rather than the lowest one you could do
=INDEX(A2:A20,MATCH(LARGE(C2:C20,INT((COUNT(C2:C20)+1)/2)),C2:C20,0))

Resources