I'm trying to do a Lookup formula to get get the exact value based on two fields against 3 fields (two of the lookup fields are Min and Max fields) so the idea is to get the value based on field name and another numeric field against two fields because it is a range of numbers
Lookup Table
Table where formula will be created (Inside LookupResult). See below the expected result where Price 150 for 101-A-A should be ABCD
Thanks for the help
You just need some indexing, no need for MATCH nor VLOOKUP. For example:
Formula in H2:
=INDEX(D:D,MAX(INDEX((A$2:A$3=F2)*(B$2:B$3<=G2)*(C$2:C$3>=G2)*ROW(A$2:A$3),)))
Or, if rules can really only apply to a single row:
=INDEX(D:D,SUMPRODUCT((A$2:A$3=F2)*(B$2:B$3<=G2)*(C$2:C$3>=G2)*ROW(A$2:A$3)))
Related
Given Table 1, I am able to calculate the sum of the revenue with the SUMPRODUCT formula. Though, I would like to be able to filter out specific areas directly in the formula. The formula listed below gives the correct result (13,000) when area B is filtered out of the data with:
=SUMPRODUCT(--(Sales[Area]<>Exceptions[Area]);Sales[Quantity];Sales[Price per unit])
However, when I add another area in Table 2, the formula returns an error. Is it possible to filter out multiple variables (areas) directly in the formula?
Use ISERROR(MATCH()):
=SUMPRODUCT(--(ISERROR(MATCH(Sales[Area];Exceptions[Area];0)));Sales[Quantity];Sales[Price per unit])
--(ISERROR(MATCH(Sales[Area];Exceptions[Area];0))) will return 1 if the area is not found in the search area, because the MATCH will return an error when it is not found in the list.
I am trying to index match some data into a table but as there are multiple matches Im not getting the match i need which would be the match with the largest value.
I have tried using maxif and lookup but had no luck as of yet with getting it to work.
One table has item number only, the next has item number, price and quote date but the same item can have up to 10 rows with different pricing/dates.
I'd like to pull in the most recent quote date with the item in table 1.
Any help would be much appreciated!!
I tried this concept before like this...
First approach:
I added a column which has the following formula (assuming that id in B:B) (put this formula in D:D column)
=A1 & "-" & countif(A2:A$999,A1)
for the childs table so i made custom index for every single row
and then in the master table (assuming you want to show the value of C:C)
=INDEX(Sheet1!C:C,MATCH(A1&"-0",Sheet1!D:D,0))
Second approach:
will be to use the new MAXIFS formula but you will need a newer excel version
for this approach you will need a sequent index column which just has the row number 1,2,3
and then use this formula:
=INDEX(Sheet1!C:C,MAXIFS(Sheet1!A:A,Sheet1!B:B,A1))
Here is a simplified version. I was trying to match the shop grade from a given table to the data but it returned error, what's wrong with my vlookup function? I'm an Excel beginner.
The data:
The given table:
You are trying to match Column B so your lookup range should start with that:
=VLOOKUP(B2,Table!B2:C3,2,False)
Vlookup requires the first column to be the lookup column.
You have to look up by referencing the first column in the table. In this case, change B2 to A2 and it will work.
What is vlookup?
Does a lookup for a specified value in the left most column of a specified table(table_array) vertically from top to bottom and returns a value from one of the columns(column_index_number) of the table. Formula follows
VLOOKUP(lookup_value,table_array,column_index_number,[range_lookup])
These are common pitfalls with vlookup.
If table A is used to lookup and table B is getting populated with values
Lookup value is not first column of table array(table A)
Lookup column on table array is not sorted - sort using excel sort function in Data tab
Dragging the formula would have caused Table array to shift for each lookup in table B. E.g A1:C10 may become A2:C11 for second lookup and can result in #NA if lookup result falls in top rows which is missing. Use $A$1:$C$10 as lookup array table A to make sure that formula is not affected while dragging the cells. Alternately, naming table array can also be employed.
Range lookup true can result in getting invalid results even when no result is present in table A. Using range lookup false will be accurate in most cases.
Reference :
MS Office vlookup help
Named tables in Excel
I have a data source in the format as the one below. In reality, that would contain few thousand rows.
I need to use something like INDEX-MATCH-MATCH in order to be able to get the "Status" for each "Content" item for each UserID.
The final result should look like this. The first two columns are not dynamic.
The INDEX formula goes to C and D.
I am using the following sequence to try and write the formula, but I don't seem to understand where the problem is.
=INDEX(Sheet1!A:K, [Vertical Position], [Horizontal Position])
look up the user with ID xxx:
=INDEX(Sheet1!A:K, MATCH(A2, Sheet1!A:K,0), [Horizontal Position])
look up the status for eLearn1.
=INDEX(Sheet1!A:K, MATCH(A2, Sheet1!A:K,0), MATCH("Status", Sheet1!A:K,0))
What am I doing wrong?
The question is not clear, but I think you are trying to do a LOOKUP based on the values of two columns. So for a particular value of Column A (UserID) and Column B (Content) you need to return Column H (Status).
This can be done using an array formula to return the row number of the matching line which can be fed into INDEX. Note, that this will only work as long as Columns A&B only have unique pairings.
I have set up some sample data:
Columns A-C are my source data. Cells G2:H4 are the lookup.
The formula is:
=INDEX($C$1:$C$7, SUM(($A$1:$A$7=$F2)* ($B$1:$B$7=G$1)*ROW($C$1:$C$7)))
This needs to be entered as an array formula by pressing CTRL-ALT-ENTER.
The formula works by matching the value you are searching for in both arrays and multiplying out the results. This should give you a result array consisting of all False with one True indicating the matched row. This is then multiplied against the row number to return the correct row to the INDEX formula.
I'm trying to compare values across two columns (Product and Location) in Excel to highlight duplicates, but I can't figure out the logical test. I'm looking for rows that match three criteria:
Product value is duplicate
Product value is not blank
Duplicate 'Product' values occur with different 'Location' values
(Products with the same value in the same location are assumed to be distinct for a value I don't have, but products with the same name at different locations may be duplicate).
Edit: I want the formula to evaluate to true only if the same Product occurs in more than one Location.
I can figure out the first two conditions by themselves, but can't figure out how to incorporate the third. I've sorted the table so that the duplicate values should appear next to each other, but there are too many to check by eye.
I'm currently using this logical test for conditional formatting using the first two criteria. 'Product' occurs in column C, 'Location' occurs in column I.
=AND(C1<>"",COUNTIF($C:$C,C1)>1)
Given your criteria, I think what you need would be the CountIfs function for the 3rd criteria....
Your final formula would look as follows:
=AND($C1<>"",COUNTIF($C:$C,$C1)>1, COUNTIFS($C:$C,$C1,$I:$I,"<>" & $I1)>0)
In effect, your third criteria is saying Count if the product matches C1 AND the Location does NOT equal I1
Hope that does the trick!
NOTE:
The more I think about it, the more I'm pretty sure you do not need your second criteria... I've been trying to think of an example where your second criteria would affect the result of this final outcome, but can't find one....
Just something to consider....
It might be overkill, but how comfortable are you with PivotTables?
Insert a pivot table, and put the "Product" in the row, with the data as the "count" of Location.
Then add a column with a formula similar to:
=GETPIVOTDATA("Location", <top left cell of pivottable> ,"Product", <cell that has product you want a count of>)
The "Location" and "Product" text would have to match your column titles.
The easiest way to get the forumla right is to type "=" in the cell you want to have the value in, and then click on the pivot table cell that contains the value. You then replace the static text, with the cell that has the value you want to look up.