Count number of times specific text is in an array - excel

I have a list of annoyingly non-standard data, the titles of trouble tickets, that I need to find a way to standardize into categories and then count the number of cells that fall into one of the categories. I have been attempting to use the following formula:
=SUMPRODUCT(--ISNUMBER(SEARCH(G:G,A2)))>0
Where G is my list of categories and A2 is the first cell in my list of ticket titles. The issue is this formula just returns TRUE or FALSE, which is not helpful in my case. Does anyone have any suggestions? Here is an example of the data I am dealing with:
web browser pointing to wrong web page
excel will not save
outlook popups on startup
logon issue
etc
It would be useful if instead of returning TRUE, the formula returned whichever category it found, i.e. if it found browser in the category array, for the first example it would return browser, rather than TRUE.

Try this formula
=INDEX(G$2:G$100,MATCH(1,INDEX(ISNUMBER(SEARCH(G$2:G$100,A2))+0,0),0))&""
If multiple items in G2:G100 appear in A2 then this will just list the first one (from G2:G100)
Note: if you have "Brow" and "Browser" in the list then it will find both and return the first in the list, so you need to list them with the longest first, ideally, or change to this version so you only match whole words
=INDEX(G$2:G$100,MATCH(1,INDEX(ISNUMBER(SEARCH(" "&G$2:G$100&" "," "&A2&" "))+0,0),0))
The first formula returns a blank if nothing found, the second one returns #N/A
Edit:
If each category in G2:G100 has an associated text in adjacent column H2:H100 then you can change the formula to return the column H value by changing the very first range in the formula, e.g.
=INDEX(H$2:H$100,MATCH(1,INDEX(ISNUMBER(SEARCH(G$2:G$100,A2))+0,0),0))&""

I think you should reverse your logic in that case, and put a formula next to each category (in H:H) with a COUNTIF, so in H1:
=COUNTIF(A:A, "*"&G1&"*")
And so on down the column.

Related

Trying to match two lines of text and return a third in excel

I have a couple of different large lists of equipment on seperate worksheets I am trying to consolidate. The first sheet "List" contains multiple columns of information, including one for the area it will be relocated to. Another sheet, "Locations," contains the three areas where each piece of equipment will be relocated to, seperated in to 3 columns; at the top of each column are the names of the locations 2500, 2900, and Term. The issue is, the Equip# from the "List" sheet only partially matches the names on the "Locations" sheet.
List
Locations
As you can see above, A2203-76 under Equip# only partially matches A2203-76 20% NAP TANK AGITATOR.
This is the formula I am using {=INDEX(Locations!$A$2:$C$2,,MIN(IF(Locations!A3:C151="A2203-76",COLUMN(Locations!A:C),0)))}. This unfortunately will only return the first column value, which is 2500. What should happen is: First, on the List sheet, the New Gear Location cell should check the Equip# cell in the same row, after retrieving the Equip# it should go to the Locations sheet and search for a partial match to what it retrieved from the Equip# cell. After finding a partial match, it should look at the column the match was found in and return one of the 3 cell values from the top "2500, 2900, or Term" based on what column it was found in and fill this value in the cell on the List page that the formula was entered in to.
Another issue, which makes me think this may not be possible, is there are also instances of A2203-75. So I question if excel has the ability to apply I guess "weights" to different partial matches. What I am getting at is, if I applied some function to partially match A2203-76 to something on the other page, would it just stop at A2203 and pick the A2203-75? Or would it look at the whole string first and find the correct instance? Maybe my thinking is wrong, but if you could offer any help I would appreciate it.
Is this what you mean?:
=INDEX(Locations!$A:$B,MATCH(List!$A2&"*",Locations!$C:$C,0),COLUMNS($A:A))
Paste this formula in List!B2 and drag right, down.
It searches for your search text followed by wildcard *.
!! Please note that this will return the first match.
If you are searching for A2203-76 and your data also contains A2203-761 it will return this value if it's found prior to A2203-76 !!

VLookUp with Nested SUMIFS

I have been trying to make a form for some of my team members who are not that computer literate, and I essentially want to make it click and go. I thought I could do it...but alas I am not as good with nesting functions as I thought I was.
I have this spreadsheet where I want to put data into the yellow cell. On the next sheet I have the below table. What I want to do is use a formula to fill H4 with the "Request Branch's" Account Number. Now, I have currently filled the cells with information. They, in fact, have drop down options - which are pulled from the Account List table. As a result the value in H4 will continually change based on the needs of the user - but must be within the confines of the Account List Table.
What I have tried is here and enter link description here. I keep getting result of #Value, or N/A. I can't figure out what I am doing wrong. I know that I need to nest the SUMIFS withing VLookUp, but I am not sure as to why it won't work.
I'm providing you with two possible solutions.
1) The first one uses the SUMPRODUCT function. You may not have seen this kind of notation before.
When ranges are multiplied by each other like so (B3:B8=G3)*(C3:C8=G4) they are actually turned into boolean arguments. If you highlighted this part of the code and pressed F9 it would look like this: {0;0;0;0;1;0;0}. This is an array where TRUE for both criteria meet. So our Branch is "A" and our Carrier is "F". In the rest of the cases either or both are false resulting in zeroes.
Now if you multiply this array by the range with account numbers, obviously the only number remaining will be the one multiplied by 1 and so you have the answer however keep in mind that as you are multiplying if the account is not a number the function will fail!
2) This is why we have a second method using =INDEX() and =MATCH() functions.
To overly simplify this - the INDEX function grabs contents from an array at a specified position (row and column), while the MATCH function gets the position of an item in an array.
The idea with using ranges as multiple criteria is the same as in the first example, however this time when we get our array of zeroes and ones {0;0;0;0;1;0;0} we use the match function to find at which position our criteria cross (as seen on the screenshot it's the 5th position, as it's in the 5th row of the entire column D, the match function searches the {0;0;0;0;1;0;0} array for a 1 and returns its position in the array) and so this is our ROW.
Knowing the position of the contents we searched for we use the INDEX function to grab the contents of the cell in that position so =INDEX(D2:D8,MATCH(1, INDEX((B2:B8=G3)*(C2:C8=G4),0),0)) is actually =INDEX(D2:D8, 5) meaning that the INDEX function grabs contents of the 5th row from the range D2:D8 which is cell D6.
The green boxes are just there to show the instance where both of our criteria are met (cross).
Please try this formula.
=INDEX(Table1[Account],SUMPRODUCT((Table1[Branch]=F$3)*(Table1[Carrier]=F$4)*ROW(Table1[Account]))-1)
Note that you may have to adjust the final -1. This is because the indexed table starts in row #2 and the SUMPRODUCT function returns a sheet row number. If your table would start in a different row the difference between the sheet row and table row would be larger. It must be adjusted here. Or you might work with sheet references (named ranges) and require no adjustment at all.

Find and remove duplicate IDs and replace

I have very basic user Excel knowledge. I have a spreadsheet where I keep track of reloading data. Each load I enter gets a unique load number that is calculated automatically with a formula, based on the caliber name and an incrementally increasing number. As of now, every load I enter gets a number, even if it's been repeated before. Popular loads that I repeat often are all the same except for the date and numbers of rounds made but currently will have different load numbers. Is there a way to skips these repeated loads and assign it the previous load number or not assign a load number at all, with a formula instead of manually?
I know this is asking for a great deal but I'd greatly appreciate any help! I'm certainly open to suggestions if this isn't even the best way to go about this.
Sample workbook at:
https://www.dropbox.com/s/v5y1ufxjiosmnap/My%20Reloading%20Data%20-%20Sample.xlsx?dl=0
Here's what I've tried so far:
In column Q2, combine all the criteria.
=C17&E17&F17&G17&H17&L17&M17&N17&P17
In column R2 look for duplicates.
=IF(COUNTIF($Q$2:$Q17, $Q17)>1, "Duplicate", "")
D2 is the Load # column.
=IF(R17="Duplicate","",(TEXT(C17,0)&"-"&TEXT(COUNTIF($C$2:C17,C17),"000")))
This will skip the duplicate loads and not give them a load # leaving the cell blank. I'd love to find and match what that load # should be and insert it. Also, when the sequential numbering resumes it acts as if it's counted the duplicate row. For instance D2 might look like:
9mm-001
9mm-002
(Skipped for duplicate and left blank, but would like it to find, match, and insert the duplicate load #)
9mm-004 (I'd like to to be 9mm-003)
You should be able to achieve this with a VLOOKUP formula or a combination of MATCH and INDEX.
VLOOKUP (Vertical Lookup) looks for a match in another cell and returns a value from an offset column. A non match, if you use FALSE as the last parameter, returns a #N/A error.
So, in D20 (for example) you could, using column Q as your determinant, use the following, assuming you had a copy of D in column R:
=IFERROR(VLOOKUP(Q20,Q$1:R19,2,FALSE),[value for newly found loadno])
What this formula does is calculates a VLOOKUP - if that doesn't find a record, calculate a new value. The VLOOKUP will look at the concatenated key in the current row Q column, search through all previous columns (note it is anchored at row 1, but not anchored for the bottom of the range so you can copy the formula), it uses the column 2 (Q is column 1, so R is column 2) for the result, and demands an exact match (FALSE). If it doesn't find one, return NA and let the second half of the IFERROR take over.
See how you go with this.
The MATCH INDEX may work better because you won't need the additional R column due to VLOOKUP only being able to look to the right of the key.
Here is an INDEX and MATCH solution - slightly harder to understand, but a more flexible solution.
=IFERROR(INDEX(D$1:D19,MATCH(Q20,Q$1:Q19,0)),[value for newly found load number])
I prefer this.
The outer function says return the nth value in the list. The inner MATCH function says find this value (Q20) in this list (Q1:Q19). The 0 as the third parameter of the MATCH function says the match has to be exact.

Assign a value to a variable [Excel]

I'm making a basic inventory list for my place of work and want to make it easier for future inputs and changes. So far I have inputted all of the model numbers for our inventory, and I was wondering how I could assign a price to the model number, so that it automatically fills it into the cell two cells right. I'm also working with around 50 model numbers, so it would be a lengthy function.
Example:
B E
778740 125.99
778739 120.99
778740
Is there a way that the second "778740" could be automatically filled in? I'm fairly new to excel and I can't find this problem, although I know it is very simple and exists. Even if some one could link me it that would be very much appreciated. Thank you!
Suppose your headers are in row 1, model numbers in column A and prices in column B. You could use the following formula in cell B3 and drag it on down as far as you need. Then what you fill in in column A matches something above, the cell next to it will automatically populate. And otherwise it stays blank, letting you know it is on you to fill it in (though once you do, the formula will no longer be there, so if you later fill in a match above, the magic is gone).
=iferror(indirect("B" & (1+match(A3,A$2:A2,0))),"")
The match function returns an error if nothing is found, and ifError will handle that by leaving your cell blank. If a match is found, we get the value from the corresponding row in column B.

Seeking help to excel in Excel

This pictures shows my table and formula's yield
I have used following formula to extract result from a table.
Its working perfectly fine but I am hoping to level up my understanding of Excel formulas.
The trouble is that I use IF in Excel way to often.
what I wanted to know is if its possible to use a different approach, something that can work similar to if but is perhaps more sophisticated.
=IF(OR(J2="08L",J2="08R"),IF(ISNUMBER(MATCH(LEFT(I2,3),'SID separations'!$D$34,0)),"LAM",IF(ISNUMBER(MATCH(LEFT(I2,3),'SID separations'!$D$35:$E$35,0)),"West",IF(ISNUMBER(MATCH(LEFT(I2,3),'SID separations'!$D$36:$G$36,0)),"East",IF(ISNUMBER(MATCH(LEFT(I2,3),'SID separations'!$D$37,0)),"SFD",NA())))),0)
I very much appreciate any help.
Now that there is an example, I think this is a good question. You've recognised that your formula is fairly messy and also can't be easily expanded if there are more routes.
The problem is that Excel is very good for searching for a value in a single row or column, but not as good for searching for a value in a block of data.
You can simplify this problem by creating an additional column that has each entire route in a single cell. You can do this just by concatenating values. In your example, use column H:
=B2&" "&C2&" "&D2&" "&E2&" "&F2&" "&G2
This will create a string with the entire route in a single cell. Spaces are added in between each part of the route to make sure you don't accidentally create a sequences of letters that matches part of another route. It doesn't matter if there are blank cells, there will just be some extra spaces at the end which doesn't matter. Fill this down the column to get the entire path for each route in a single cell.
Then, you can create a formula that tries to find the 3 letters anywhere in any of the full routes.
=INDEX($A$2:$A$5,MATCH("*"&left(I2,3)&"*",$H$2:$H$5,0))
This formula is basically a deconstructed vlookup. It determines where the 3 characters can be found in column H, then gives back the corresponding value from column A.
The MATCH function tries to find the left 3 characters of I2 in column H. The MATCH function normally tries to find a complete exact match (with the last parameter being equal to 0), but we can just add wildcards to the search value. The MATCH function then returns the index of the range where it was found. I.e., if it was found in the 2nd cell of the range H2:H5, it returns the number 2.
The INDEX function then just gets a value from a range based on an index. In this case, it will get the 2nd value from range A2:A5.

Resources