I have two lists, where I need to see if values from the 1st list is also present in the 2nd list. However, due to the way my system is formatted, some values from the 1st list contains multiple values, that needs to be looked up.
If just one of the values is present in the 2nd list, it should print that value.
1st list values:
COLUMN A:
C00276129, CDK1029191
CAE031070
CAU029379
2nd list values:
COLUMN B:
CDK1029191
CAE031070
CUS0000000
CUS0000002
As you can see, in list one, some of the values may be printed out on the same row, but seperated by comma.
I am trying to get VLOOKUP to search for both values in list 1 and compare to the entire list 2:
=IFERROR(VLOOKUP(A1 & "*";B:B;1;FALSE);"Value not present")
However, above just returns "Value not present", even though the value on the first row is indeed present in list 2.
You can use this "Clumsy" formula to return just value that was found in case 2 values are in same row. =TRIM(IFERROR(VLOOKUP(LEFT(A2,FIND(",",A2,1)-1),B:B,1,FALSE),"")&" "&IFERROR(VLOOKUP(RIGHT(A2,LEN(A2)-FIND(",",A2,1)-1),B:B,1,FALSE),"")&" "&IFERROR(VLOOKUP(A2,B:B,1,FALSE),""))
Related
I have been trying and searching how to append two lists in excel to use in a formula. The lists do not exist in columns, they are created using a formula. I want to combine the two lists in a single one, not to show the values but to use the new list in a formula. I am using excel 365 (UNIQUE function). Let me replace my initial text by a real small case.
I have an excel file with 3 work sheets. Sheet1 is:
Sheet2 is:
Now I want to run some analysis in Sheet3. In my example I want to count how many unique values from column A have column B containing one of the letters 'a', 'b, 'c', or 'd'. For instance, in Sheet1, the letter 'a' appears in all rows. Column A has 3 unique values. So my result for 'a' is 3. The letter 'b' does not appear for the case where column A is '3'. Therefore the result for 'b' is '2'.
So I create a Sheet3 to show my results. The first column contains a list of letters {a, b, c, d}. I then use the formula:
=COUNT(UNIQUE(FILTER(Sheet1!$A$1:$A$100, ISNUMBER(SEARCH(A1, Sheet1!$B$1:$B$100)))))
From inside out: the SEARCH function looks in cells B1 to B100 (I can live with specifying a larger range) where is the position of the value specified in column A (of the current sheet). If it does, then SEARCH returns a number. I check if the return value is a number (ISNUMBER) and use this to filter values in column A of Sheet1. I then apply the UNIQUE function to these values and finally count them.
Then I do the same with values in Sheet2. And it works. This is the output:
Column B is the number of unique values (as specified above) from Sheet1 and Column C the same from Sheet2.
So far so good. But now I want to have the counting of unique values globally. Not for each Sheet. One cannot just add the values from column B and C, as there might be an overlap. For example, the result for 'a' should be 3, not 5.
The solution here would be to grab the two unique lists (one from Sheet1 and the other from Sheet2), join them, UNIQUE this new list, and count. How do I join them ? That is my question.
Note that this 'counting of unique values' is just an example. I might want to find the maximum, or sort them, or find only prime numbers, or the average, or the median, or something else. So I need a general approach to join the results.
I got options close to a workable thing when all the data is in the same worksheet.
Finally, note that the data size I have is not huge, but it is large (thousands of lines at the most).
Here is something you could try:
=LET(x,{"A","B","C"},y,{"D","E"},z,CHOOSE({1,2},x,y),cnt,MAX(COUNTA(x),COUNTA(y)),seq,SEQUENCE(cnt*2),final,INDEX(z,MOD(seq-1,cnt)+1,CEILING(seq/cnt,1)),FILTER(final,NOT(ISERROR(final))))
Here both 'x' and 'y' variables are placeholders for your two (vertical) arrays. In this case I used: {"A","B","C"} and {"D","E"}. Assuming you just want to place the 2nd array directly under the 1st one, the above suggestion does just that:
I have an excel spreadsheet that has a Name Date match in two columns for one list, and the same name date match for two columns in a 2nd list.
One list is longer than the other, how can I find the data that is missing in the matching date/name from the other list?
For instance let's say
List 1 List2
1/2/2012 Tim 1/2/2012 Tim
2/2/2012 Jill 2/2/2012 Jill
3/2/2012 Bob
So basically I need to search list one and find out that List 2 is missing "3/2/2012 Bob" both the dates and names are in their own columns.
How do I do this? Keeping in mind that these lists have no order and that it is possible that someone in list2 might show up in list1 just not on the same row.
If List 1 is in columns A and B, and List2 is in columns C and D, then select an area the same size as List 1 (or the size of List 1 minus List2--make sure it has 2 columns) and enter this as an array formula (ctrl+shift+enter):
=IFERROR(INDEX(A2:B4,SMALL(IFERROR(MATCH(A2:A4&B2:B4,C2:C3&D2:D3,0)+ROWS(A2:A4),ROW(INDIRECT("1:"&ROWS(A2:A4)))),ROW(INDIRECT("1:"&ROWS(A2:A4)))),{1,2}),"")
Expand the rows as needed. Also, you'll need to format the first output column as a date.
EXPLANATION UPDATE
The Evaluate Formula dialogue is helpful for breaking down complicated formulas. Select the cell with the formula and press alt then T then U then F ("TUF" for tough formulas...).
Start with the MATCH function. Since we're looking for a date-name match, concatenate the name and date columns with &. MATCH will tell us which pairs in List 1 are also in List2 (specifically where--we'll get an array of indices in List2 where the matches were found in List 1). If a match is not found, it will return #NA. So for the OP's example MATCH will return {1;2;#NA} (the first value in the List 1 array is in position 1 in List2, the second value is in position 2, and the third value was not found in List2).
The second argument in the inner IFERROR is an array of the indices of List 1. ROWS returns the number of rows in a range, INDIRECT returns a safe (meaning it won't be accidentally deleted or moved) reference to rows 1 through the number returned by ROWS, and ROW returns the row number of each of the rows--so in the OP's example, this is {1;2;3}.
We want the elements from List 1 that were not found in List2, so we add the number of rows in List 1 to the non-error MATCH results. This will send those values to the end of the array returned by SMALL. For the OP's example, the array passed as the first argument to SMALL is {4;5;3}.
Now we want to bring the indices of interest to the top using SMALL. We use ROW(INDIRECT("1:"&ROWS(A2:A4))) again as the second argument in SMALL to sort the array smallest to largest. For the OP's example, the resulting array is {3;4;5}.
We then pass that array to INDEX as the "row_num" argument and {1,2} as the column argument. INDEX will then pull both columns from the range that we give as its first argument for each row in the array that resulted from SMALL. The values at the end of the array that resulted from SMALL are larger than the number of rows in List 1 (since we added ROWS(A2:A4) to them), so they will result in #REF! errors. These correspond the the elements that returned a match in the MATCH function. We wrap this with yet another IFERROR to blank out the errors.
I have have two data sets which I need to compare. There is a column that is the common identifier between the two, but the 2nd data set, which is updated, has more than the 1st data set.
Here is how I extracted the data sets that I need:
What I'm trying to do is use columns D/I as the key, then see if columns C/H match. If they do not match I want that data returned or just highlighted.
I'm not very familiar with Excel, but I see the issue, in addition to what I described above, as being since the 2nd data set has more rows, the it will return those as highlighted, which it doesn't need to.
Any help would be great!
If I understood your problem correctly, you may try
=C2=INDEX(H:H,MATCH(D2,I:I,0))
and extend / drag this formula to check for more values in D column.
This formula results like this:
This formula compares values in D with values in I column and then compares corresponding C and H values and returns True when they match otherwise returns False.
In other words: This formula checks if a pair of Cx-Dx exactly matches with pair Hy-Iy where x and y are not necessarily equal.
E.g. (refer above screenshot)
C2-D2 matches with H2-I2
C3-D3 matches with H4-I4
C4-D4 matches with H3-I3
and C5-D5 matches with no pair in H:I range.
You can also use COUNTIFS either in a separate column or conditional formatting:-
=COUNTIFS($I:$I,$D2,$H:$H,"<>"&$C2)
to highlight the first two columns and
=COUNTIFS($D:$D,$I2,$C:$C,"<>"&$H2)
to highlight the second two columns.
I want to use IF, INDEX and MATCH function together to get the output from the another sheet that has two columns (one of them in always blank and so need value from a column which in not blank).
The formula I'm using looks like :
=IF(ISBLANK('DATA 1'!B:B);
INDEX('DATA 1'!B:B;MATCH(OUTPUT!B14;'DATA 1'!A:A;0));
INDEX('DATA 1'!C:C;MATCH(OUTPUT!B14;'DATA 1'!A:A;0)) )
This formula is returning values from one column only and when the corresponding column is blank it shows #N/A .
I want it to show the value from whichever column (out of the two on another sheet) that is not blank.
You should be using:
=IF(ISBLANK(INDEX('DATA 1'!C:C,MATCH(OUTPUT!B27,'DATA 1'!A:A,0))),INDEX('DATA 1'!B:B,MATCH(OUTPUT!B27,'DATA 1'!A:A,0)),INDEX('DATA 1'!C:C,MATCH(OUTPUT!B27,'DATA 1'!A:A,0)))
though you need to be aware that ISBLANK will return FALSE when passed a null string (""), so if any of your entries in 'DATA 1'!B:B or 'DATA 1'!C:C contain such an entry (perhaps as a result of formulas in those cells), then the above will not give correct results.
As such, more rigorous is:
=IF(INDEX('DATA 1'!C:C,MATCH(OUTPUT!B27,'DATA 1'!A:A,0))="",INDEX('DATA 1'!B:B,MATCH(OUTPUT!B27,'DATA 1'!A:A,0)),INDEX('DATA 1'!C:C,MATCH(OUTPUT!B27,'DATA 1'!A:A,0)))
Assuming the returns are text, not numeric, you could also use the shorter:
=LOOKUP(REPT("z",255),INDEX('DATA 1'!B:C,MATCH(OUTPUT!B27,'DATA 1'!A:A,0),N(IF(1,{1,2}))))
though its brevity is arguably offset by its complexity and, again, this will fail if null strings are present in those ranges.
Let's say I have a few columns, five for example. Multiple rows. For each individual row, on column A and B, I have two strings that I would like to reference. Columns C and D add up into column E, which totals the two values.
What I'm looking to do is reference the largest values in the chart, pull that number, and also return the two strings in columns A and B.
I know you can pull the largest number in range x,y in col E with =LARGE(Ex:Ey,1), but how does one reference the row that the number represents?
Let's say for reference that the two strings in the sixth row are Alpha and Bravo, and this sixth row contains the largest value (26 for example) that I want to pull.
I'm looking for a way to get the output 26 Alpha Bravo, if that's possible. I'm making a list going from largest to smallest, so I'm looking for a way to incorporate LARGE in there as well - looking to pick the 10 largest values and their respective strings.
Any thoughts?
I'm looking for a way to get the output 26 Alpha Bravo, if that's possible.
Please try:
=MAX(E:E)&" "&INDEX(A:A,MATCH(MAX(E:E),E:E,0))&" "&INDEX(B:B,MATCH(MAX(E:E),E:E,0))
try =MATCH(LARGE(A1:A6, 2),A1:A6,0)
Large returns the value you are looking for, and match will find the row it is in. Use the row starting in row 1 for match to give you the physical row, not the instance within the list. Match with the third argument set to zero is basically a find first, and the Match function can also accept wildcards.