Get string inbetween two different characters at nth position - excel

I have a spreadsheet containing image files in a column as such. I need to grab the product sku in the file names.
enter image description here
Example: "Img_Brand_AA_2021_202020-RD-Mens-Pant-RED-720p_Studio_1849.png"
The product SKU in the above example is: "202020-RD"
I need a formula to grab that product SKU. I've tried the following formula but it only spits out "2020" and I can't get it to grab the SKU.
=MID(E2, FIND(CHAR(1),SUBSTITUTE(E2,"_",CHAR(1),4))+1, FIND(CHAR(1),SUBSTITUTE(E2,"-",CHAR(1),3)) - FIND(CHAR(1),SUBSTITUTE(E2,"-",CHAR(1),2))-1)
One thing to note is the Product SKU can be longer than 6 characters.
Thanks!
I've tried the following formula but it only spits out "2020" and I can't get it to grab the SKU.
=MID(E2, FIND(CHAR(1),SUBSTITUTE(E2,"_",CHAR(1),4))+1, FIND(CHAR(1),SUBSTITUTE(E2,"-",CHAR(1),3)) - FIND(CHAR(1),SUBSTITUTE(E2,"-",CHAR(1),2))-1)

Assuming no Excel version constraints as per tag listed in the question. You can try the following:
=TEXTAFTER(TEXTBEFORE(A1,"-",2),"_",-1)
Here is the output:

Related

How To Create Column Filter List and Display Different Text Than Cell Value In Excel

At my job, we use a tracking system for docket numbers that are formatted as 2022-xxx-xxxxx (year, 3 digit group identifier, 5 digit task # identifier.
Our company is comprised of around 10 different groups, and each group is assigned a 3 digit group identifier. For example, the group called FM is identified as 507. Another group, NC, is identified as 503. A third group, EM, and is identified as 509. The group identifier will always be the second number after the first dash in the docket number.
What I would like to do in excel is create a tracking sheet where I can use a column filter to sort all the active dockets by their group identifier. I want the value in the cell to display as the full docket number 2022-507-xxxxx but for the Column filter list option to display only the 3 digit group identifier number.
I’ve attached a mock up image of what I would like it to display as for context (made using photoshop)
Any help is greatly appreciated. Column Filter vs Cell Value Example
Why not do a new column =MID(C1,6,3) and use a filter on that one?

Retreiving specific letters from Text in Microsoft Excel

I have the column as you can see in this image.
The Distributor Address is in the format: "Street Address, Postcode, State".
I need to retrieve only "Postcode" and "State" and combine them.
The new column should be like this ➡"NSW2007","VIC3182"...
How could I retrieve the specific letters and combine them?
You can use FILTERXML if you have the newest version of Excel. See Excel - Extract substring(s) from string using FILTERXML for an excellent overview.
In this case, something like the below should work:
EDIT: overlooked the specific format you wanted
=FILTERXML("<t><s>"&SUBSTITUTE(A1,",","</s><s>")&"</s></t>","//s[3]")&
FILTERXML("<t><s>"&SUBSTITUTE(A1,",","</s><s>")&"</s></t>","//s[2]")
Well, here is a different way:
=RIGHT(A2,3)&","&TRIM(MID(A2,FIND(",",A2,1)+2,LEN(A2)-FIND(",",A2,FIND(",",A2,1)+1)))
This does rely on the state being the last 3 characters and the postcode after the first comma...
There are several ways of solving that. I will show a solution using a few basic functions: RIGHT, MID and LEN.
Assuming your data is on A1:
=RIGHT(A1,3)&MID(A1, LEN(A1)-8, 4)
RIGHT returns the 3 last characters from the cell A1.
MID returns the middle of the cell given a starting position and a length.
LEN gives you the starting position of the zip code, which is always the length of the string - 8 in your table.
Is it essential that your data is well organized as in the image to work well. One alternative is finding the ", " as below.
=RIGHT(A1,3)&MID(A1, FIND(", ",A1)+2,4)

Matching Columns in Excel: different files

I have two excel files, One with product ID and description in English. Other one with the same ID and Description, but in French, but the IDs are not in same order in both files, they are listed randomly but both have the same IDs. (there are over 10000 products in the list.)
I want a formula such that I can find all the products by it's ID, Match ID with the IDs in the second file (the French one) and paste all the French description right beside English description column.
How can I make this process faster, I would have done it manually but there are 10,000 items in the list so it would take a lot of time for me.
You can Use Index- Match
Where your ID is in Column A and Description is in Column B
=INDEX([Book2.xlsx]Sheet1!$B:$B,MATCH(A1,[Book2.xlsx]Sheet1!$A:$A,0),1)
Or you could use Vlookup IF only two Columns involve
=Vlookup(A1,[Book2.xlsx]Sheet1!$A:$B,2,0)

Excel: formula to identify missing sku

I have a list of 1500 sku. Currently we have an active inventory of 450 sku.
I am looking for an excel formula that will identify when the sku inputed is not an active sku of the 450.
I have tried various IF functions, but having a hard time breaking it down.
I have tried this:
=IF($B2=F1:F460, COUNTIF(PRODUCTION!$A$1:$AJ$45, $d2), "")
The first part of the equation is where we input the inventory. F1:f460 is a list of all the active sku. The second part of the code is where it goes to look for the code if it on the production sheet.
I need to know when we put a sku into the inventory if it is correct or not.
=isnumber(Match(SKUYouWantToTest,450SKURange,0))
The match returns a number if the SKU is in the list, and an error otherwise. The isnumber converts it to a TRUE if it exists, and a FALSE otherwise
=SUMPRODUCT(--(SkuToTest=F1:F460))>0
The logic behind this is explained here. If you want to show only skus that are not in your list, you can wrap it in an IF like so:
=IF(SUMPRODUCT(--(SkuToTest=F1:F460))>0,"","FALSE")

Extracting text from complex string in excel

The attached image (link: https://i.stack.imgur.com/w0pEw.png) shows a range of cells (B1:B7) from a table I imported from the web. I need a formula that allows me to extract the names from each cell. In this case, my objective is to generate the following list of names, where each name is in its own cell: Erik Karlsson, P.K. Subban, John Tavares, Matthew Tkachuk, Steven Stamkos, Dustin Brown, Shea Weber.
I have been reading about left, right, and mid functions, but I'm confused by the irregular spacing and special characters (i.e. the box with question mark beside some names).
Can anyone help me extract the names? Thanks
Assuming that your cells follow the same format, you can use a variety of text functions to get the name.
This function requires the following format:
Some initial text, followed by
2 new lines in Excel (represented by CHAR(10)
The name, which consists of a first name, a space, then a last name
A second space on the same line as the name, followed by some additional text.
With this format, you can use the following formula (assuming your data is in an Excel table, with the column of initial data named Text):
=MID([#Text],SEARCH(CHAR(10),[#Text],SEARCH(CHAR(10),[#Text])+1)+1,SEARCH(" ",MID([#Text],SEARCH(CHAR(10),[#Text],SEARCH(CHAR(10),[#Text])+1)+1,LEN([#Text])),SEARCH(" ",MID([#Text],SEARCH(CHAR(10),[#Text],SEARCH(CHAR(10),[#Text])+1)+1,LEN([#Text])))+1)-1)
To come up with this formula, we take the following steps:
First, we figure out where the name starts. We know this occurs after the 2 new lines, so we use:
=SEARCH(CHAR(10),[#Text],SEARCH(CHAR(10),[#Text])+1)+1
The inner (occurring second) SEARCH finds the first new line, and the outer (occurring first) finds the 2nd new line.
Now that we have that value, we can use it to determine the rest of the string (after the 2 new lines). Let's say that the previous formula was stored in a table column called Start of Name. The 2nd formula will then be:
=MID([#Text],[#[Start of Name]],LEN([#Text]))
Note that we're using the length of the entire text, which by definition is more than we need. However, that's not an issue, since Excel returns the smaller amount between the last argument to MID and the actual length of the text.
Once we have the text from the start of the name on, we need to calculate the position of the 2nd space (where the name ends). To do that, we need to calculate the position of the first space. This is similar to how we calculated the start of the name earlier (which starts after 2 new lines). The function we need is:
=SEARCH(" ",[#[Rest of String]],SEARCH(" ",[#[Rest of String]])+1)-1
So now, we know where the name starts (after 2 new lines), and where it ends (after the 2nd space). Assuming we have these numbers stored in columns named Start of Name and To Second Space respectively, we can use the following formula to get the name:
=MID([#Text],[#[Start of Name]],[#[To Second Space]])
This is equivalent to the first formula: The difference is that the first formula doesn't use any "helper columns".
Of course, if any cell doesn't match this format, then you'll be out of luck. Using Excel formulas to parse text can be finicky and inflexible. For example, if someone has a middle name, or someone has a initials with spaces (e.g. P.K. Subban was P. K. Subban), or there was a Jr. or something, your job would be a lot harder.
Another alternative is to use regular expressions to get the data you want. I would recommend this thorough answer as a primer. Although you still have the same issues with name formats.
Finally, there's the obligatory Falsehoods Programmers Believe About Names as a warning against assuming any kind of standardized name format.

Resources