Comparing two lists for partial id in the text - excel-formula

I have two lists, one of the list contains inputs like these:
Description1 (id)
Description2 (id2)
Description3 (id3)
other list is again like these:
Descriptionx (id)
Descriptiony (id2)
Descriptionz (id3)
What I need to is compare them and show a new list with non existing ids in the second list. The descriptions could be different, the id locations could be different also there are some with additional parenthesis like this:
Description (id)(other info)
So I need to exclude those other info from id comparison also.
Would VLOOKUP help me with what I want? If it is how could I use it for partial match?
Here is a sample file to explain what I mean.. The data is randomized, but I matched some ids in the parenthesis on the A and B columns, the C column should only list the ids not existing in B column.

OK, based on your picture, this would be the formula: ARRAY FORMULA: CTRL + SHIFT + ENTER
=INDEX($A$1:$A$77,SMALL(IF(ISERROR(MATCH(MID($A$1:$A$77,SEARCH("(",$A$1:$A$77)+1,SEARCH(")",$A$1:$A$77)-SEARCH("(",$A$1:$A$77)-1),MID($B$1:$B$57,SEARCH("(",$B$1:$B$57)+1,SEARCH(")",$B$1:$B$57)-SEARCH("(",$B$1:$B$57)-1),0)),ROW($A$1:$A$77)),ROW(A1)))
This creates a list of the missing ID's of list 1 in list 2. Be careful with ROW($A$1:$A$4) as it has to be the same length as the search list and needs to start at row 1. ROW(A1) needs to start at row one.
If you want a list of all matching id's just change ISERROR to ISNUMBER.

So, you can use iferror() and vlookup() like this:
This, at least, will give you something to start with, you can develop it how you wish.

Related

Using VLOOKUP and not only match on first value

I'm trying to use VLOOKUP to match activities with product codes, but run into an issue since VLOOKUP always returns the first match. I did a mockup below to describe my issue. To the left, I have a table with activity names and product codes.
To the right, in column G, I want to, based on matching activity names in column F with activity names in column A, assign the activities product codes from column B.
When I use VLOOKUP, it only matches with the first activity name and give all the activities with the same name the same product codes. I need them to get different product codes even if they have the same name. I want my function to "take the next one" on the list, when the first one is taken.
Should I try to use another function to solve this? Is it impossible with VLOOKUP? My 'real' document has like 2000 rows, and the solutions I found on Youtube was not good to scale.
Thanks in advance. I'm new to here so if I should clarify my question in any way, feel free to tell me.
If the raw is around 2,000 rows, you can use a nested index match with helper columns.
Add a rank in column C with the formula =COUNTIF(A2:$A$2,A2)
Then apply the same ranking in your output part as well (Ensure Activity Name is sorted so that the formula works), Output rank formula =IF(J2=J1,I1+1,1)
Formula that lists out the Product Code {=INDEX($B$2:$B$3190,MATCH(I2,IF($A$2:$A$3190=J2,$C$2:$C$3190),0))}
This is an array formula, you get the curly brackets by hitting control+shift+Enter instead of just Enter upon keying in the formula
If you are using excel 365, you can use UNIQUE formula.
=UNIQUE(A2:B18)

Index Match Partial Criteria

I'm trying to Index/Match a column with shortened criteria. The idea is to Pull the Line of Business from the column without producing dozens of "duplicate" Unique Lines of Business.
Currently, I get a list like:
Whereas I just want:
I don't want to use a fixed list lookup, as the data is varied enough to not be practical using a fixed list
The ARRAY formula so far: {=IFERROR(INDEX($C$1:$C$155,MATCH(0,COUNTIF($Q$156:Q156,$C$1:$C$155)+COUNTIF($C$1:$C$155,$C$1:$C$155<>1),0)),"")}
Is there a way to search in the text for the company name without creating a new column?
You would need to use some sort of formula like this to filter your countif query =IF(ISNUMBER(SEARCH("company",A1)),"Company "&MID(A1,FIND("company",A1)+8,1),"").
This code searches your list for the word company and then outputs the word "Company" then searches 8 positions to the right from the start of the word and returns the number.

How can I create a list based on another list where a category contains specific value?

So to make it easy let's say I have a table of 3 columns and x rows.
These 3 columns are called;
Name
Price
Type
Under Name there'd be a list of e.g. [Apple, Banana, Steak, Kiwi, Spagetti].
Then under Price would be e.g. [2, 1, 5, 2, 3]
And under Type would be [Fruit, Fruit, Meat, Fruit, Pasta]
Now I want to make a list somewhere separate that uses this list as base and then automatically updates as such;
Get the Name where Type = "Fruit"
If the name already exists in this list, skip the row and look to the next (no duplicates)
When user inserts something in the middle of the list or append to it, update the order that the items are in the same order to the list we're reading from. (Stay in order)
[optional] Print these in order in a column, with in the cell next to it (next column) the corresponding Price
The last one is optional because I could of course replace Name with Price where Type = Fruit, and get the wanted result.
However I'm not sure how to do this. Currently I have;
=INDEX($A$2:$A$100,MATCH("Fruit", $C$2:$C$100,0),1)
However this would return only the first occurrence of said MATCH in the array.
Simply making it like this;
=INDEX(A2:A100,MATCH("GAME", C2:C100,0),1)
Would give duplicates.
Also neither of these lines give the attached Price.
I've also been playing around, trying to make my own function, but I really just got into it so I'm not quite sure what I'm doing or even supposed to be doing.
TL;DR I'd like to make the 2 groups on the right automatically based on the first group as shown in the picture below:
In cell E3 use this formula:
=IFERROR(INDEX($A$2:$A$10,SMALL(IF($C$2:$C$10=E$1,ROW($C$2:$C$10)-MIN(ROW($C$2:$C$10))+1),ROW()-2)),"")
entered as an array formula (press Ctrl+Shift+Enter when exiting cell edit mode). see here for formula explanation
Run down for as many rows as necessary and change the $10 row limit to what is needed.
F3 is a simple vlookup: =IFERROR(VLOOKUP(E3,$A:$B,2,0),"")
drag down and also copy to column H and I accordingly.

count unique values between defined range in column

I've got column which consist numbers of type 000.XX.XX
=COUNTIFS(temporary!$A1:$A200,">=000.11.35",temporary!$A1:$A200,"<=000.11.39")
this formula counts values between 000.11.35 and 000.11.39. But i want to count only unique values. How can I do this?
There is not a built-in function for this, as you can see from the several suggestions of how to accomplish this on the Office support site. If you can, you can switch to Google Sheets, and they have a "COUNTUNIQUE()" function.
As described at the link provided above, identify the unique items, either using a filer (this is static) or through repeatedly using the "FREQUENCY()" function. Then count the unique items in a separate step.
Lets say you have the data set in the first column, first you need to remove the repetitions in a second column with the following array formula (confirm the formula with Ctrl+Shift+Enter)
=IF(SUM((A2=$A$2:A2)*1)>1,"",A2)
this formula lists only unique values
I would remove your first 4 digits of your string to create a float number and then count it with the following array formula:
=SUM((IF((RIGHT($B$2:$B$14,4)>=RIGHT(G3,4))*(RIGHT($B$2:$B$14,4)<=RIGHT(G4,4)),$B$2:$B$14,"")<>"")*1)
Please look at the two images for clarification
view with formulas
normal printscreen

I have multiple IDs for items, how can I use VLOOKUP to scan next column if it doesnt find it in the first?

Imagine my dataset has multiple IDs in columns, for the same item. How can I use VLOOKUP to scan the next column in the order up until it finds the same ID in another dataset? Or if it does not exist just stop searching after 6 columns? Thanks!
You could do this with 6 nested IFERROR statements; that would look like this: (Assuming your ID columns are A->F, your results column is G, and your search term is in J1):
=IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(VLOOKUP(J1,A:G,7,0),VLOOKUP(J1,B:G,6,0)),VLOOKUP(J1,C:G,5,0)),VLOOKUP(J1,D:G,4,0)),VLOOKUP(J1,E:G,3,0)),VLOOKUP(J1,F:G,2,0))
This looks at each column (starting with F and working outwards), and if it can't find a match, it creates an error, so goes to the next column. It is not very clean to read. A better way using this same methodology could be to use a combination of INDEX & MATCH, like so:
=INDEX(G:G,IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(MATCH(J1,A:A,0),MATCH(J1,B:B,0)),MATCH(J1,C:C,0)),MATCH(J1,D:D,0)),MATCH(J1,E:E,0)),MATCH(J1,F:F,0))
Though this is a little shorter [because we don't need to specify the entire block of data, or which column to pull from, as it always pulls from column G], it is still not very readable.
Let's try this instead using an Array Formula which runs the same function multiple times over many cells, gets the result for each cell, and provides an array of results. Then we just need to collapse that array into a single value, like so:
=INDEX(G1:G14,MIN(IFERROR(IF(SEARCH(J1,A1:A14&B1:B14&C1:C14&D1:D14&E1:E14&F1:F14)>0,ROW(A1:A14),""),"")))
Confirm this formula with CTRL + SHIFT + ENTER instead of just ENTER. This adds all strings of all search columns together, basically making a single column of values. It then takes that column, and searches each cell for the word found in J1. If it finds it, it returns that row number, otherwise it returns "". The function then uses MIN to take the lowest row number found (to tie-break to the earliest row, if there is a duplicate), and then uses that with INDEX to return the value from that row in column G.
Note that the logic here is a little different from the options I gave above, as it defaults to the earliest row #, rather than the earliest column #, of a match.

Resources