Hoping someone can help me write a formula. I have table one where a certain title/string is listed multiple times. I also have table two where i have 2 columns, one with ID the other with same titles. I need to be able to assign IDs in table one from table 2 if they match
Just use the MATCH function. This will return the index of the matching cell. To get a True/False value, use the ISERROR method. Like so:
=IF(ISERROR(MATCH(A1,B:B, 0)), "False", "True")
Where:
- B is the column you want to match against
- A1 is the cell you want to check
Related
I'm trying to search and match data from 3 different tables which are connected through an id and if the outcome is 1 of 5 options, then it is Yes or NO
see picture below for example. the yellow column should be filled it. the picture shows what the result should be.
Just some nested INDEX & MATCH could work for you:
=IFERROR(INDEX(K$3:K$7,MATCH(INDEX(H$3:H$7,MATCH(INDEX(E$3:E$7,MATCH("*"&A3&"*",D$3:D$7,0)),G$3:G$7,0)),J$3:J$7,0)),"")
MATCH allows the use of a wildcard and is at least as fast as VLOOKUP would be but usually faster!
You can do it like this:
Here's the code if you want to copy/paste & try it out:
=IF(VLOOKUP(VLOOKUP("*"&A3&"*", $D$3:$E$7, 2,FALSE), $G$3:$H$7, 2, FALSE) < 4, "Yes", "No")
I guess the biggest difference is that it will say "N/A" instead of "Empty" when there is no match.
Sapman.
Here's my suggestion to your particular case:
=IFERROR(VLOOKUP(VLOOKUP(IF(MIN(IF((LEN(SUBSTITUTE($D$2:$D$6,A2,""))-LEN($D$2:$D$6))<>0,ROW($D$2:$D$6)-1))=0,"",INDEX($E$2:$E$6,MIN(IF((LEN(SUBSTITUTE($D$2:$D$6,A2,""))-LEN($D$2:$D$6))<>0,ROW($D$2:$D$6)-2)))),$G$2:$H$6,2,FALSE),$J$3:$K$7,2,FALSE),"EMPTY")
It is based on the following logic:
first we take a value from Table A and remove it from Table B
then we check the length of the resulting string, if it's now different (i.e. LEN(XXACA)=5, LEN(XX)=2)
if it's different, we return the ROW number minus 2 (as your tables have two header rows)
then we use INDEX/MATCH to return the value of that row in Table B
then we do VLOOKUP twice to get data from Table C and Table "If/Then"
There are several error-handling parts as well which esure that you get the result you requested.
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)))
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 have a large Excel dump from SQL with many columns of data. Two of those columns have different fields with various text values. There are six correct values for the first column and five correct values for the second column. I need to count the accounts (column A) that have both "correct" values.
Well, I just stumbled on this guy:
=COUNTIFS(A:A,"val1",B:B,"val2")
where:
A:A is the first column you have.
"Val1" is the valid value in the first column you want.
B:B is the 2nd column you have.
"Val2" is the valid value in the 2nd column you want.
Unfortunately, that only works if you have 1 value for each column .. and they work more like an AND .. not an OR.
So rather than that, I'd suggest a "helper column":
1) setup your list of valid values somewhere else, and name the lists: "validcol1" and "validcol2"
==IF(OR(ISERROR(MATCH(A2,validcol1,0)),ISERROR(MATCH(B2,validcol2,0))), "", "Valid!")
I solved it through and array that uses "find."
{ =SUM(1*(IFERROR(FIND(b1:b413,"0B,D,E,K,L,S"),0)>0)*(IFERROR(FIND(c1:c413,"0ZA,ZB,ZC,ZF,ZK"),0)>1))}
Note the use of the leading 0 at the start of each set of values.
It's my understanding hard-coding the values into the formula isn't ideal. Anyone have any ideas for that?
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.