I am hoping someone can help with this Excel 2016 issue. I have done extensive searching on the net and believe I have found the formula to address my requirements. Before sharing the formula, let me explain my need.
I am creating a budget spreadsheet. There is currently two sheets in the spreadsheet. sheet1 contains data for categories and keywords. Column A contains different categories like Car Fule, Salary, Bank Fee, etc. Column B contains keywords to be search for within the transaction description. An example could be:
car fule | Mobile
Sheet2 contains all the transaction data. All the columns other then column c isn't relevant for this issue. An example of a transaction description could be: "EXP mobile Hobbitville 2221 MiddleEarth".
I am trying to create a formula that does a search in the defined cell for column c, against the keywords found in sheet` column b. Then once a match is found, perform a indirect function call to give the category of the transaction. I cannot get the initial search to work.
Formula that should work is:
=countif(c2,"*"&sheet1!$b$1:$b$85&"*")
This always gives a value of 0 saying it hasn't been found. I am using ctrl shift enter and ctrl enter to make the an array formula. If I press f9, I get all the values defined from sheet 1 as {0, 0, ...} (or something like that) which is what I expect. In that array, I should get at least one element as a '1' (true value). If I can fix this part of the formula or find a better method, then I can build the rest of the formula. Any one with ideas?
This is the COUNTIF syntax,
COUNTIF(range, criteria)
It should be the other way around,
=COUNTIF(C:C,"*"&Sheet1!$B1&"*")
Let me know if its not working
Related
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)
UPDATE: found an answer to my problem through this website: https://exceljet.net/formula/categorize-text-with-keywords
I'm trying to categorize certain products based on the beginning of each product name. My first table is the look-up table below:
My second table currently looks like this:
And I want the end result of that second table to look like this:
What excel formula can I use to achieve the red column? I've tried scouring the internet, for the formula that best suits my need, but I can't figure it out. I've seen people throw out the =Lookup(Search()) function, but my formula needs to start with the key word, but just contain the keyword somewhere in the cell.
I've read many different forums, but I haven't been able to find one that answers a scenario similar enough to mine. Any suggestions are appreciated.
If the first word of the Product Name is always matched to the product start, you can vlookup by just the 1st word. Assuming your product start is in column A, Categerization in Column B, Product Name in Column C, you can key in the formula in Column D:
'''
=vlookup(left(C2,search(" ",c2)-1),A:B,2,0)
'''
Just set your vlookup 4th parameter to TRUE:
Note: formula as written can be drag/filled down from B2. Also your Category Table needs to be in A-Z sorted order.
HTH
I have a spreadsheet that shows the actual dollars produced and the expected dollars produced for each employee, where each row is one day and each employee has two columns. I would like to count the number of times an employee came within 10% of their production goal without referencing specific columns. Please look at the example spreadsheet.
I want for the formulas in cells Sheet2!E4:E7 to do what the formulas in Sheet2!E10:E13 do.
I am trying to avoid using direct column references because it causes me to have to go in and update the columns in the formulas every time a new employee is added to the sheet.
I'm no stranger to using INDEX+MATCH, or to converting SUMPRODUCT formulas to INDEX+MATCH. What I can't get past are the formulas in cells Sheet2!E4:E7. If you evaluate the formula you can watch the INDEX+MATCH section on the left side of the formula work correctly, and then a nearly identical INDEX+MATCH section on the right side evaluate to 0 for no apparent reason.
The formula I'm having trouble with is in cell Sheet2!E4:
COUNTIF(INDEX(Sheet1!$A$2:$AZ$314,,MATCH($B4,Sheet1!$A$1:$AZ$1,0)),">"&(INDEX(Sheet1!$A$2:$AZ$314,,MATCH($B4,Sheet1!$A$1:$AZ$1,0)+1)))
The section to the left of the ">" will match with the correct range (Sheet1!B2:B314), however the section to the right of the ">" will evaluate to 0 instead of Sheet1!C2:C314.
This is strange to me because the only real difference between the two sections is the '+1' on the end of the MATCH function, and adding the '+1' to the section to the left of the ">" produces the expected result for the MATCH function (Sheet1!C2:C314) as seen by evaluating the formula in cell Sheet2!E5.
The formula that produces the correct result is in cell Sheet2!E10:
SUMPRODUCT(--(ISNUMBER(Sheet1!$B$2:$B$313)),--(Sheet1!$B$2:$B$313<Sheet1!$C$2:$C$313),--(Sheet1!$B$2:$B$313>=Sheet1!$C$2:$C$313*0.9))
I understand that if I exclude the '$' before the column references, any future additions/subtractions to the columns on Sheet1 will adjust the references accordingly. This solution is not ideal, because there are multiple data sheets (one for each year) where the columns are all different (Dan is column F for 2019, G for 2018, M for 2017, etc.), and the tables using these sheets are laid out in a way that would prevent me from easily being able to auto-update the formulas, so a solution that locates the correct column using the employee's name is preferred.
The correct result should be 2 for Allen and 3 for Torres, but I can only seem to get the INDEX+MATCH formulas to return 0, 12, 15, 16, or 17 (depending on what tweaks I make to the formula).
Any help with this would be greatly appreciated.
You can try this: ARRAY FORMULA CTRL + SHIFT + ENTER
=SUM(IF(ISNUMBER(INDEX($A$1:$E$30,2,MATCH(G9,$A$1:$E$1,0)):INDEX($A$1:$E$30,30,MATCH(G9,$A$1:$E$1,0))),INDEX($A$1:$E$30,2,MATCH(G9,$A$1:$E$1,0)):INDEX($A$1:$E$30,30,MATCH(G9,$A$1:$E$1,0))<INDEX($A$1:$E$30,2,MATCH(G9,$A$1:$E$1,0)+1):INDEX($A$1:$E$30,30,MATCH(G9,$A$1:$E$1,0)+1)*(INDEX($A$1:$E$30,2,MATCH(G9,$A$1:$E$1,0)):INDEX($A$1:$E$30,30,MATCH(G9,$A$1:$E$1,0))>=INDEX($A$1:$E$30,2,MATCH(G9,$A$1:$E$1,0)+1):INDEX($A$1:$E$30,30,MATCH(G9,$A$1:$E$1,0)+1)*0.9))*1)
and adapt the ranges to your needs. It is entered on the same sheet as the data.
Basically this approach uses ARRAY FORMULA CTRL + SHIFT + ENTER
INDEX($A$1:$E$30,2,MATCH(G9,$A$1:$E$1,0)):INDEX($A$1:$E$30,30,MATCH(G9,$A$1:$E$1,0)))
to get the needed ranges. MATCH looks for the right column. the row number can be set as needed, here its is from 2 to30 adapted to your provided data. My search term in this case is in G9 with Allen as content. The result of the formula is $B$2:$B$30. A +1 after Match gives the other range $C$2:$C$30. Both ranges can then be evaluated with the needed conditions
Pull it down and provide Torres in G10. Then the ranges will be adapted to $D$2:$D$30 and $E$2:$E$30.
I am trying to create code that will help me achieve the correct format. All I want is to pull employee (EE) entire row and paste into a new sheet, and then second part (ER) value to match the same employee.
In other words, if employee pay pension contributions for 100 (Pen EE (Tal)) and employer pay for 200 (Pen ERS (Tal)) on behalf of the same employee. Then, the worksheet should look like Column A= Pers No, Column B=Employee Name, Column C= ID Number, Column D=PenPay, Column E=Pens EE(Tal) and Column F=Pens ER(Tal) and G= Total (Pen EE +Pen ER values), as exactly in example tab.
I hope this makes sense. I have tried several methods but no luck so far. Thank you all for your help.
From your problem description, I think I can decipher that you are using Excel.
I see three basic approaches to solving your problem:
The simplest approach is not to use VBA at all and instead use the workbook functions INDEX and MATCH. The latter returns the row or column where an exact match is found in the search range, which has to be one dimensional. (The exact match actually requires the search option 0.) The function INDEX returns the value at the given row and column in a range. Combining both, you get a more flexible verision of VLOOKUP and HLOOKUP, which you can use to find the values in the second table for a given employee. (MATCH returns an N/A error if no match is found.)
The second approach is to use the Excel object model in VBA. You can search a range for a value using the Find method of the range. This returns the cell where the match is found and Nothing in case there is no match. If the search result is not Nothing, you can use the EntireRow property to get the entire row and the Cells property to select cells in the row.
Finally, you can use the support of SQL for Excel via ADODB. For a description how to do this, you can look at this Microsoft page and this old question on SO. Provided you know how to write SQL queries, this should enable you to solve your problem via SQL.
I want to transfer data automatically from 2 sheets to one single combining one. That means I have 2 different exports that contain both the columns "Problem". I have one sheet, that represents an overview of the data. So when I have for example the value "A333" in A1 of my overview sheet, I want Excel to search in the two other export sheets the value "A333" and give back the value in the same row as "A333" but of the column "Problem" not "A".
The problem that I see is that I have to search TWO sheets and I don't know in which one the "A333" will appear.
Can you please help me? I would preferably like to solve the problem with a formula, not a macro. Thank you very much in advance.
1) write a formula (VLOOKUUP() for example) that looks for the value in the first sheet
2) write a formula that looks for the value in the second sheet
3)since VLOOKUP returns an ERROR if a value is not found you can combine the formulas together using IFERROR(). for example: =IFERROR(VLOOKUP(ref_cell,sheet1_range,2,0),VLOOKUP(ref_cell,sheet2_range,2,0))
EDIT:
It looks like you did not provide all the pertinent information in your question!
I suggested VLOOKUP(), but this will only work if you know which COLUMN the value you are looking for will appear in, but you said this is not the case...
using you comments I therefore assume the following:
the two test sheets are called "test1" and "test2"
The reference value we are looking for is in cell A5 on the main sheet, cell D1 on the sheet contains "Problem" (text)
The reference value may appear anywhere (I limit here to range A1:J100) on test1 or test2, but ONLY ONCE
The column "Product" on test1 and test2 may appear in different columns, but it will always have a heading "Product" in row 3 (test1!A3:J3 and test2!A3:J3)
see below of screenshot of the answer (column C shows result, column D shows the underlying formula)
If required use the information provided to create a single-cell formula (because Stack Overflow is not a we-write-the-answer-for-you service)
Following the scheme:
and add the formula:
E3 -> =CONCATENATE(IFERROR(VLOOKUP(D3;$A$12:$B$15;2;FALSE);"");IFERROR(VLOOKUP(D3;$A$3:$B$6;2;FALSE);""))
and autocomplete ...