Excel Partial Match on Another Column and Categorize - excel

How do I check if one word in a column contains keyword in another column, and then categorize using Excel?
I am trying to categorize my credit card statement.
First Excel sheet has transaction list of all the stores, vendors, with extra keywords.
Second Excel Sheet has keywords and their categories.
Trying to use Vlookup, partial matches, not sure. There could be 200 transactions in a credit card statement each month, and 50 categories lookup.
Resource below.
Excel Sheet 1:
Credit Card Description
Amount
Category (trying to fill in)
Store Amazon
25
Equipment
Vendor McDonalds TX
4
Food
Maple Doctor Office
47
Medicine
Emerald Bakery
9
Food
Excel Sheet 2:
Vendor
Category
Amazon
Equipment
McDonalds
Food
Doctor
Medical
Bakery
Food
Resources:
https://www.automateexcel.com/formulas/vlookup-contains-partial-match/

Try FILTER() function with COUNTIFS().
=#FILTER($H$2:$H$5,COUNTIFS(A2,"*"& $G$2:$G$5 & "*"))
To fill down result automatically can use MAP() or BYROW(). Try-
=MAP(A2:A5,LAMBDA(x,FILTER(H2:H5,COUNTIFS(x,"*"& G2:G5 & "*"))))
For Excel 2016:
=LOOKUP(,-FIND(" "&Sheet2!$A$2:$A$10&" "," "&A2&" "),Sheet2!$B$2:$B$10)
=IFERROR(INDEX($H$2:$H$5,AGGREGATE(15,6,ROW($1:$5)/(COUNTIFS(A2,"*"& $G$2:$G$5 & "*")),ROW($1:$1))),"")

Related

How to find from which cell text is contained in given cell

So I have a formula that shows if a cell contains text from a list:
=SUMPRODUCT(--ISNUMBER(SEARCH("List of companies in Worksheet A",A1)))>0
It works correct, but I need to further expand this formula.
I have a two data worksheet:
W1 is a list of companies and that show preferred companies for given product in given country,
W2 is a list of documents that show which company has been use in which country for which product.
I need formula that shows if for given document the company is preferred for given country and product.
Above formula solved the issue of company as it checks if company mentioned in W2 appears in W1, now I would need to add two more conditions, to check the country and product.
Current formula is this:
=IF(AND(SUMPRODUCT(--ISNUMBER(SEARCH("List of companies in Worksheet A",A1)))>0,"Preferred", "Non Preferred")
How do I reverse the formula so it will show me in WHICH cell the found value in W1 is so I can use simple VLOOKUP and = formula and and the conditions, like:
=IF(AND(SUMPRODUCT(--ISNUMBER(SEARCH("List of companies in Worksheet A",A1)))>0,B1=Vlookup(SUMPRODUCT(--ISNUMBER(SEARCH("List of companies in Worksheet A",A1))>0,Table in W1,1,"Preferred", "Non Preferred")
I am really stuck, please help.
An example of worksheet A
Company Name
Company Code
Country
abd
12355
Germany
aaa
23322
Austria
asc
432
France
asc
123
USA
asce
1234
Poland
An Example of worksheet B
Company Name
Country
abd - 111
Germany
aaa - 234
Austria
asc - 432
France
asc - 123
UK
asce - 1234
Romania
If I use:
=SUMPRODUCT(--ISNUMBER(SEARCH("List of companies in Worksheet A",A1)))>0
It will highlight 3 bottom rows, however I need to apply second condition so it will highlight ONLY 3rd row, the one with France.
Highlighting is pretty hard because CF rules don't allow to use references to other worksheets besides current one neither array formulas. But you may use a helper column to get the output you need and then hightlight based on that output:
Worksheet A
Worksheet B
Notice France is the only highlighted value because is the only country that fits pattern Company Name - Company&CodeCountry
Formula in column C (array formula, so you must introduce it pressing CTRL+ENTER+SHIFT:
={ISNUMBER(MATCH(A2&B2;'Worksheet A'!$A$2:$A$6&" - "&'Worksheet A'!$B$2:$B$6&'Worksheet A'!$C$2:$C$6;0))}
CR rule to highlight applied to column B is based on this formula:
=C2=TRUE()
UPDATE: If you really really need to skip the helper column, you may benefit from function INDIRECT:
INDIRECT
function
But if your dataset is big, I don't recommend this solution because it may really overcharge your file because INDIRECT is a volatile function:
INDIRECT – Excel’s Most Evil
Function
Besides, if your dataset is fixed (I mean it goes always in the same Address like A2:C6 or A2:A1000, whatever but always the same) you may use it, but it it changes all the time, it will slow down your file.
Anyways, you can make a CF rule based on this formula:
=ISNUMBER(MATCH(A2&B2;INDIRECT("'Worksheet A'!$A$2:$A$6")&" - "&INDIRECT("'Worksheet A'!$B$2:$B$6")&INDIRECT("'Worksheet A'!$C$2:$C$6");0))

Count number of rows in which value occurs in any column

Sample Data:
Desired result:
Name Number Handled
Bill 1
Erica 1
James 2
Jimmy 1
John 1
Kory 1
Setup:
Column W is "Incident Number", Column X is "Created by", Column Y is "Resolved By", and Column Z is "Updated By". The same person can create, resolve and update or can be multiple people. The boss is asking for each person in the team, how many tickets are they touching each day. So if "James" is opened, resolved, and updated ticket 22, he did one ticket. If James opened ticket 22 but Tony resolved it, they each touched ticket 22 so both get credit. Same with Updated. Could be same person, or 3 different. For each tech I need a formula to find the total number of tickets they touched, regardless of how many actions they did on the ticket.
Add another column (I used AA) that concatenates the three columns. You'll need to replace "Sheet1" with whatever the sheet name is
=CONCATENATE(",",Sheet1!X1,",",Sheet1!Y1,",",Sheet1!Z1,",")
Then your formula is a simple countif with search
=COUNTIF(AA:AA,"*,"&A2&",*")
You can use either of the following formulas to get the result (assuming your names are in column A of another sheet. Use the first formula if calculation speed isn't an issue and your number of rows varies a lot. Use the second formula for faster calculation if you can be confident that the number of rows won't go above some number. Just replace 1000 with your own number.
=SUMPRODUCT(SIGN((Sheet1!$X:$X=$A2)+(Sheet1!$Y:$Y=$A2)+(Sheet1!$Z:$Z=$A2)))
=SUMPRODUCT(SIGN((Sheet1!$X$2:$X$1000=$A2)+(Sheet1!$Y$2:$Y$1000=$A2)+(Sheet1!$Z$2:$Z$1000=$A2)))

How to search and combine several sheets in Excel?

I am trying to do an Excel sheet to do some statistics about athletes in world cup competitions.
I have a worksheet on excel for every competition, plus one for the overall result after the season (which thus has a list of every athlete that competed at least once).
The worksheets have the name of the location where the competition happened. Eg: PARIS.
I have one more sheet, named "Athletes". what I want to do there is:
for every athlete appearing in the "overall" list, I want the columns after the name to be filled with the results in every location the athlete completed in.
For example
Name Paris London LA Berlin
Amoros 1 5 / 7
Bilboni 2 43 3 12
To find "1", I want excel to search the sheet "Paris" for "Amoros" and extract the ranking in the row it finds "Amoros".
Let's say it finds "Amoros" in cell L57, then the corresponding ranking to extract will be in K57. "/" indicates Amoros didn't compete in LA.
I am using Excel 2016 on a Mac.
Thanks a lot in advance!
Ben
If you data is set up starting in A1 you would use INDEX/MATCH with INDIRECT to set the sheet:
=IFERROR(INDEX(INDIRECT("'" & B$1 & "'!$K:$K"),MATCH($A1,INDIRECT("'" & B$1 & "'!$L:$L"),0)),"/")
This formula would go in B2 and be copied over and down the dataset.

How can I incorporate a quantity field into COUNTIF function?

I am using a COUNTIFS function to compare forecast data from a customer (Sorted AC Forecast) with our current orders (Stock & Forecast).
=COUNTIFS('Sorted AC Forecast'!$A:$A;'Stock & Forecast'!$B5;'Sorted AC Forecast'!$B:$B;'Stock & Forecast'!H$3;'Sorted AC Forecast'!$C:$C;"FUTURE NEEDS")
I basically check for matches from the customer's spreadsheet for the following: 1. Model Number, 2. Delivery Week, 3. Order Type. So, if the model number in B5 in my spreadsheet is found in the customers' data, if the delivery week specified in H3 is found in the customers' data, and if order type matches, the match is counted.
The issue I am facing now is that our customer changed the format of their datasheet; it now includes a "Quantity" category.
That means that I need to incorporate the quantity, for instance if COUNTIF counts 2 matches and the quantity field reads 1 and 4 respectively, I need it to return 5.
I have attached some links to pictures of the two sheets to try and make the issue clearer.
http://i.stack.imgur.com/NqQeN.jpg
http://i.stack.imgur.com/z3ZGz.jpg
Any suggestions? I've tried using a macro to print out 3 duplicate rows if the quantity is specified as 3, only its slow and doesn't work very well.
Use SUMIFS to match the criteria and then total the "Quantity" column if the criteria match. For example if the "Quantity" column was column D:D:
SUMIFS('Sorted AC Forecast'!$D:$D,'Sorted AC Forecast'!$A:$A;'Stock & Forecast'!$B5;'Sorted AC Forecast'!$B:$B;'Stock & Forecast'!H$3;'Sorted AC Forecast'!$C:$C;"FUTURE NEEDS")

Matching partial data in rows to data in column and populate date of matched values in another row in Excel

In worksheet 'A' I have row 1 for college names. College ID is
concatenated with the college name, after a space, within parentheses.
Sheet 1 (A1:E1):
"Wyndall college (123)", "Jeffersone college (99)", "Lyndale College (45)", "Lincoln college (60)", "Salt Lake College (40)"
In worksheet 'B', I have column A for college names (no college ID
concatenated) and column B for number of students. Sheet 2 (A1:A4):
"wyndall college" 100
"Gates College" 300
"Jefferson College" 50
"Lincoln college" 150
Worksheet B many not have all college names that exist in worksheet
A and vice versa!
I want to populate row 2 (A2:E2) in worksheet A with the number of students
from worksheet 'B' if the college name matches (even partial) in the
two worksheets.
How do I do that thru Excel formula and functions?
For example:
After parsing with Text To Columns. On a larger scale Fuzzy Lookup might be more suitable.
I don't know what you mean by a "partial match". If you can match up to the ID number, and the ID number is always inside parentheses, then you can use something like:
B1: =IFERROR(VLOOKUP(TRIM(LEFT(A1,FIND("(",A1)-1)),B!$A$1:$B$4,2,FALSE),"")
and fill down.
If you only want to match the first word, then look for the first space in the Find function. If you mean something else by a "partial match", you'll have to add detail.

Resources