EXCEL: find matching values - excel

the following problem: I have an array of tables of witch I want to get a sum range of matching values. Here is the sheet:
Tables
The matching values do not have to be exact matches. For example, for 28car.com I am interested in 28car, car28 or 28 car, so values which closely resemble the website keyword. This is because these keywords are based on queries from search keywords of the respective websites and may be prone to change.
SUMIFS would therefore not work as I can only find exact matches (and these keywords may change on a monthly basis). I thought about VLOOKUP or INDEX & MATCH, but I don't know how to possibly execute either two.
Any suggestions?
https://imgur.com/a/OtzkE

well you can use VLOOKUP with true as the last parameter i think, that will give you a non-exact matching word.
Alternatively you could add another table whith all the options for the KEY you would like to find.
Maybe if you give a little more information or some sort of image, we can help you better.

Related

Excel VLOOKUP between two columns of words

I have two columns of words (Old list) and (New list)
I'm trying to check using the VLOOKUP() function both columns and find which words of the New list doesn't appear in the Old list.
(The answers here is obviously: eyes, john, martha, phone)
I'm giving this simple example to know what VLOOKUP() formula to also apply to a larger sample. In reality I have two columns of over 1000 items. Thanks
=FILTER(F2:F10, ISNA(VLOOKUP(F2:F10,A2:A10,1,FALSE)))
This will filter it down and remove all the N/A values while comparing the 2nd list to the first.
EDIT:
as per comment needing clarification (too long to put as a comment)
You can do anything you’d like by substituting references. It’s best to think of the syntax of things here to get a lay of the land and figure out what you want to pull information from.
The ISNA() just handles N/A errors that will occur with partial lists and is irrelevant to understanding where to put your references.
=filter(array, include, [if_empty])
Where “array” is the range you want to filter FROM
And “include” is what you are searching FOR from that range.
The [if_empty] is optional – you can put a text there, like “No Results” in quotes so that it’ll substitute that for N/A.
The “include” portion is where I’ve added additional information because I want to narrow in what I’m including…. In the plain and simple form of =filter() you’d just be putting a word/cell reference you’re looking for. It’ll pull every column for the whole table if there are multiple columns. But we want it to search multiple criteria simultaneously.
=vlookup(lookup_value, table_array, col_index_num,range_lookup)
what you are searching FOR (in this case anything within the table), where you want to look for it (where you are searching FROM), which column to find it in (column 1 in your case), and TRUE/FALSE – exact or approximate matches.
The easiest way to search across multiple sheets is to have the files open, and as you type in the formula bar when you get to each section click and highlight what you want by switching sheets (alt tab). Just pay really close attention to searching FOR versus searching FROM and you can do any combination of comparison you need.
If you would like TRUE/FALSE for each element you can use the following
=ISNUMBER(MATCH(A1,ColumnToSearch,0))

How to count cells in a table column that contains a specific text string (COUNT.IF doesn't work)

I need to count how many cells in a table column that contains a specific text string. I'm using this formula and it works well:
=COUNT.IF(TB_table_name[col_name];"*string_to_be_found*")
But I need to count only filtered cells.
I've found may solutions (using SUMPRODUCT) on internet, but only to common cells and not table conlumns.
This is the kind of table that I have:
As you can see, there are many values in the same cell (It happens because it is generated automatically by a survey made in MS Forms). Because of this, I need to search for a specific string to be counted.
Using "COUNT.IF" I have this results:
Please observe that the values in the cell are not random, but predefined - of course the sequence could not be the same, but the list of possible terms are.
Please, can you help me figure this out? Belive me, I have tried many things but nothing worked and it seems to be a thing so easy to achieve :(
The trick is to combine a couple of the ideas you found using SUMPRODUCT.
You likely found this reference (or one just like it) that gave guidance for a formula like this:
=SUMPRODUCT(SUBTOTAL(3,OFFSET(B2:B7,ROW(B2:B7)-MIN(ROW(B2:B7)),,1))*(B2:B7="Quality"))
Which translates to your problem-space like this:
=SUMPRODUCT(SUBTOTAL(3,OFFSET(TB_table_name[col_name],ROW(TB_table_name[col_name])-MIN(ROW(TB_table_name[col_name])),,1))*(TB_table_name[col_name]="*string_to_be_found*"))
This works perfectly fine if you're NOT using a wildcard search. But that's what you need. So in this answer it shows that the wildcard in a SUMPRODUCT needs to use the -- operator. So the result is to combine the two answers and you get:
=SUMPRODUCT(SUBTOTAL(3,OFFSET(TB_table_name[col_name],ROW(TB_table_name[col_name])-MIN(ROW(TB_table_name[col_name])),,1))*(--(ISNUMBER(FIND("string_to_be_found",TB_table_name[col_name])))))
Notice that the string_to_be_found does NOT have wildcard * specifiers. That's taken care of by the FIND function.

Extract a Word from String Containing a Specific Multiple Words

"I'm setting up a pivot in excel, and want to extract specific words from a data set of text.
I have tried using the below formula to extract one particular word, but want to nest the multiple formula to extract other words as well
=TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",99)),MAX(1,FIND("Evaluation",SUBSTITUTE(A1," ",REPT(" ",99)))-50),99))
The above formula works but only for one word. I want to create nested formula to search first word or second word or third...
If your goal is to search an array for a a substring, if that substring matches any words in a list, and if so, return the matched substring, as in the post suggested by JvdV, use the formula below, which I have modified.
I recommend, in a different worksheet, add a table with a list of the words you want to find, like this. Highlight the range of cells, including the header, then Home > Format as Table > pick a table style and give it a name. This table's name is "t_WordsToFind" (so I can easily identify it in other functions later). You may want to also put your primary data into a table as well. My go-to name is usually "t_Data". Now, instead of worrying about column numbers/letters, you have the user-friendly column headers you started with which makes reading the formula much easier. Your table ranges will also automatically expand when addtl data is added, so row numbers don't need to be referenced any more either.
If you don't have your data in tables, use this version of the formula, and remember to update your range parameters when data is added. B2 is the first cell to be searched, D2:D4 is the list of words to look for, copy the formula down. I do prefer not to use IFERROR as it includes many different types of errors that I may need to know about, like if I misspelled the function name, for example. If you simply need to have an alternative in the event no matches are return and your function is valid, I recommend IFNA.
IFNA(LOOKUP(1,1/COUNTIF(B2,"*"&$D$2:$D$4&"*"),$D$2:$D$4),"")
If you do use tables for your data and lookup tables (you are very wise) and here is the formula version to use (below). In this example, #[Search This Column] is the the equivalent to B2 and t_WordsToFind[Find This] is the table name and column name of words to look for, but it's much more legible, and doesn't need to be copied down or manually expanded in the future.
IFNA(LOOKUP(1,1/COUNTIF([#[Search This Column]],"*"&t_WordsToFind[Find This]&"*"),t_WordsToFind[Find This]),"")
Even wiser still, assuming this is a perpetual need, would be to use power query/power pivot, but I don't want you to go into TMI overload.
Also, your pivot table range will be nice and easy, "t_Data".

VLOOKUP text with two criteria

I'm looking for a way to insert a column based on two criteria, as illustrated below. I have a main table with one row per company, and I want to add a column to this with the city names. However, the lookup table has two rows for some companies - one for "small" and one for "large". I'm only interested in retrieving the cities for companies that have size value "small".
I know that I can achieve this with =SUMIFS if the content of the column was a number instead of text. However, with the cities column consisting of text, I don't know how to proceed. I'd ideally like a solution where I don't have to use a helper column.
Edit: this is just an example of my data. I have hundreds of rows,the duplicate answer suggested uses INDEX/MATCH which requires me to give the exact cell location of each condition. This is not the case in my data.
There are a few solutions that I usually use for these tasks. They're not elegant i.e. not a 2-criteria look-up per se, but they get the job done.
Going by your data structure, you have these choices:
Sort your lookup table by size-company, with size in descending order. Thereafter, it's a straightforward vlookup since your big companies are seggregated from small ones.
Build a new key consisting of company-size i.e. CONCAT(company,size) and do the vlookup based on this key.
It's not possible with VLOOKUP. Look my solution in the picture using a array formula.
Solution using array formulas
Formula in F2: =INDEX($C$1:$C$6;SUM(IF(E2=$A$2:$A$6;1)*IF($B$2:$B$6="small";1)*ROW($C$2:$C$6));1)
Ps: don't forget to confirm the formula with Ctrl+Shift+Enter.
Multi-column lookups are certianly possible but not using VLOOKUP. You'll need to use INDEX and MATCH. This becomes pretty complex as it combines array formulas with boolean logic. Here's a nice explanation.
https://exceljet.net/formula/index-and-match-with-multiple-criteria
For your example, assuming Desired Result Company is in column I.
=INDEX($F$4:$F$5,MATCH(1,(D4:D5=I4)*(E4:E5="small"),0))

Lookup Job Code, return column header if cell has text

I'm looking for a little bit of help learning about how to use vlookup and iferror formulas together.
I am working as a licensing specialist within the insurance industry. My job requires that I frequently access more than a dozen spreadsheets that are emailed to us on a weekly basis from our clients. I am working to develop tools that allow us to consolidate that information on-demand to be able to run reports. I'm having no trouble using the VLookup function to pull data from various spreadsheets using an unique identifier. I do need some help, however, with a trickier formula.
I have put together a spreadsheet that allows me to put in the ID of the representative and it returns various bits of information, such as their name, license numbers, job codes, etc. Now I need to come up with a formula that takes the value returned in the job code field and searches another spreadsheet to return what training they are required to complete based on their job code. This spreadsheet is about 2000 rows, and is formatted with the training names spanning across the top row, job codes listed in column "A" and the word "yes" in each column that matches a training that the job code is required to take.
It looks like this: https://i.imgur.com/71COmfF.png
I need the formula in my reports spreadsheet to lookup the job code using VLookup and then return the column header if the cell has text.
The data will be loaded into this spreadsheet: https://i.imgur.com/2CyFURt.png
Here is the Vlookup formula I am using to get the job code:
=VLOOKUP(B3,'.\[Weekly_HR_Report_040615.xlsx]HR'!$A:$Q,10,FALSE)
How can I pair that same kind of formula with something like an IfError formula to return the column header if there is a "Yes" in the cell of the row that matches their job code?
I know that I can work through it as an array using VBA, but I would prefer to just place a formula in each cell so that I can pass this spreadsheet to another college when I move to a different role in the future and they won't struggle too much with adding to it.
Thanks for any help that you might be able to provide! I really appreciate it!
I would use INDEX and MATCH to cross reference and retrieve the titles where applicable:
=IF(INDEX('JobCode_Training.xlsx'!$A$1:$H$6,MATCH($H$5,'JobCode_Training.xlsx'!$A:$A,0),2)="Yes",INDEX('JobCode_Training.xlsx'!$A$1:$H$6,1,2),"")
=IF(INDEX('JobCode_Training.xlsx'!$A$1:$H$6,MATCH($H$5,'JobCode_Training.xlsx'!$A:$A,0),3)="Yes",INDEX('JobCode_Training.xlsx'!$A$1:$H$6,1,3),"")
=IF(INDEX('JobCode_Training.xlsx'!$A$1:$H$6,MATCH($H$5,'JobCode_Training.xlsx'!$A:$A,0),4)="Yes",INDEX('JobCode_Training.xlsx'!$A$1:$H$6,1,4),"")
etc.
I wasn't sure what your reference table is saved as, so you'll need to replace 'JobCode_Training.xlsx'! with whatever the correct path is.
Since you have multiple trainings that can apply to each jobcode, you'll either need to have multiple cells for the results, or you can concatenate them into one.
The following article from excelvlookuphelp.com answers your question I believe...
The Problem
You might be expecting that not all of your search values are going to return something from the search table. Instead of the formula returning #N/A you’d like the result to look different when your vlookup value isn’t found (either blank or an indicator to show that the value hasn’t been found or a zero if you’re wanting to do maths with the results).
The Solution
You can use the iferror function.
It works like this
= iferror (YourVlookupFormula, WhatToSayInsteadOf#N/A)
Here’s an example
=iferror(vlookup(D3,A:C,3,false), “No Value Found”)
Or if you would rather it was just blank then instead of having No Value Found, just have the two sets of inverted commas, like this
=iferror(vlookup(D3,A:C,3,false), “”)
source: excelvlookuphelp

Resources