CURRENT SCENARIO
The functions below create a custom SKU based on a hard-coded supplier and its respective URL syntax
<insert excel="" file="" here="">
(I don't know why this is coming out all multi-colored)
THE CHALLENGE
The above solution works fine* for a single supplier on a sinble tab; however, when working with various suppliers on the sam tab, challenges are created which are:
- SKU prefixes cannot be hardcoded in the function for a single supplier using the current method (i.e., "WAL")
- Different suppliers have different URL syntax
THE DESIRED RESULT
A two-pronged function that:
- identifies the supplier by URL, and builds a SKU beginning with a prefix (ex., "WAL", "COS", "SAM"). The supplier prefix will always be 3 characters in length (references an array - preferably a named list, such as "SUPP_PREFIX")
- then returns the item# from that specific supplier's URL and concatenates the SKU properly with a hyphen separating the two returned values (ex. "WAL-1234567")
SUPPORTING DETAILS
The ability to identify the supplier from a URL will ALWAYS be in between "www." and ".com" - the beginning portion of the URL. This syntax will always be constant and true.
Context Examples:
<supplier><supplier><supplier><supplier><supplier><supplier><supplier><supplier><supplier><supplier><supplier><supplier>www.supplier.com
http://www.supplier.com
https://www.supplier.com
Content Examples:
<item#>www.walmart.com/ip/ITEM#
"walmart" identifies as "WAL"
<item#>https://www.samsclub.com/sams/ITEM#.ip
"samsclub" identifies as "SAM"
<item#>https://www.costco.com/.product.ITEM#.html
"costco" identifies as "COS"
As alluded to above, the function would then reference a secondary array based on:
- a particular supplier's name, and then
- recognize that supplier's syntax to know where to extract the specific item#
SPECIFIC ITEM# LOCATION
The exact location of the suppliers' item# appear in the examples provided above (Content Examples).
I have what appears to be working solutions for Walmart and Costco.
With Sam's Club however, I get mixed results*. On the referenced Excel table above, Examples 6 & 7 return inconsistent results. The output should only be the supplier prefix, hyphen, item# (Ex. SAM-1234567).
Note - the correct SKU output for Example 6 should be: SAM-prod5380361 because that's what appears between the last forward slash and ".ip"
What modification to this function would target only what appears between the last foward slash and ".ip"?
PUTTING IT ALTOGETHER
Functions are not my strong suit but I try my best to understand what they do and with the help of this community, I've been successful in piecing together what works for previous projects.
Below is a function that successfully worked for creating hyperlinks based on evaluating the name of a carrier in the URL. I believe that in this function solves the question about how to identify the supplier in order to determine the supplier prefix but I need help tying it altogether to go a step further and properly concatenate a perfect SKU just by evaluating a URL.
My attempts can be seen on the "Reference" tab and the two named lists I've created there; "SUPP_PREFIX" and "SUPP_ITEM".
I see a flaw right away in that in the "Reference" tab specific cell references are coded in and I just don't know how to make that "neutral" or "variable" for a lack of better words.
I hope this write-up is chocked full of details to clearly express what I need done and I'm happy to actively engage and try solutions you propose.
Thanks!</item#></item#></item#></supplier></supplier></supplier></supplier></supplier></supplier></supplier></supplier></supplier></supplier></supplier></supplier></insert>
The functions below create a custom SKU based on a hard-coded supplier and its respective URL syntax
Excel 2013 32 bit | |||||
---|---|---|---|---|---|
A | B | C | |||
1 | Example | SUPP URL | CUSTOM SKU Output | ||
2 | 1 | https://www.walmart.com/ip/33857317 | WAL-33857317 | ||
3 | 2 | https://www.walmart.com/ip/Mainstays-Metal-Canopy-Bed-Multiple-Colors-Multiple-Sizes/126889322 | WAL-126889322 | ||
4 | |||||
5 | 3 | https://www.costco.com/Aquaterra-Spas-Ventura-96-jet%2c-6-person-Spa.product.100355896.html | COS-100355896 | ||
6 | 4 | https://www.costco.com/Urban-Islands-304-Stainless-Steel-5-burner-Grill.product.100075481.html | COS-100075481 | ||
7 | |||||
8 | 5 | https://www.samsclub.com/sams/118235.ip | SAM-118235 | ||
9 | 6* | https://www.samsclub.com/sams/oif-vertical-file-cabinet-4-drawer-economy-letter-26-1-2-black/prod5380361.ip | SAM-black/prod5380361 | ||
10 | 7* | https://www.samsclub.com/sams/chair-leather-coil-b/prod12930214.ip?xid=cat1838-offi:carousel-save-on-office-chairs:2:4 | SAM-on-office-chairs: | ||
DATA |
Cell Formulas | ||
---|---|---|
Range | Formula | |
C2 | =IF(B2<>"","WAL-"&TRIM(RIGHT(SUBSTITUTE(B2,"/",REPT(" ",LEN(B2))),LEN(B2))+0),"") | |
C3 | =IF(B3<>"","WAL-"&TRIM(RIGHT(SUBSTITUTE(B3,"/",REPT(" ",LEN(B3))),LEN(B3))+0),"") | |
C5 | =IF(B5<>"","COS-"&LEFT(TRIM(RIGHT(SUBSTITUTE(B5,".product.",REPT(" ",20)),20)),LEN(TRIM(RIGHT(SUBSTITUTE(B5,".product.",REPT(" ",20)),20)))-5),"") | |
C6 | =IF(B6<>"","COS-"&LEFT(TRIM(RIGHT(SUBSTITUTE(B6,".product.",REPT(" ",20)),20)),LEN(TRIM(RIGHT(SUBSTITUTE(B6,".product.",REPT(" ",20)),20)))-5),"") | |
C8 | =IF(B8<>"","SAM-"&LEFT(TRIM(RIGHT(SUBSTITUTE(B8,"/sams/",REPT(" ",20)),20)),LEN(TRIM(RIGHT(SUBSTITUTE(B8,"/sams/",REPT(" ",20)),20)))-3),"") | |
C9 | =IF(B9<>"","SAM-"&LEFT(TRIM(RIGHT(SUBSTITUTE(B9,"/sams/",REPT(" ",20)),20)),LEN(TRIM(RIGHT(SUBSTITUTE(B9,"/sams/",REPT(" ",20)),20)))-3),"") | |
C10 | =IF(B10<>"","SAM-"&LEFT(TRIM(RIGHT(SUBSTITUTE(B10,"/sams/",REPT(" ",20)),20)),LEN(TRIM(RIGHT(SUBSTITUTE(B10,"/sams/",REPT(" ",20)),20)))-3),"") |
<insert excel="" file="" here="">
(I don't know why this is coming out all multi-colored)
THE CHALLENGE
The above solution works fine* for a single supplier on a sinble tab; however, when working with various suppliers on the sam tab, challenges are created which are:
- SKU prefixes cannot be hardcoded in the function for a single supplier using the current method (i.e., "WAL")
- Different suppliers have different URL syntax
THE DESIRED RESULT
A two-pronged function that:
- identifies the supplier by URL, and builds a SKU beginning with a prefix (ex., "WAL", "COS", "SAM"). The supplier prefix will always be 3 characters in length (references an array - preferably a named list, such as "SUPP_PREFIX")
- then returns the item# from that specific supplier's URL and concatenates the SKU properly with a hyphen separating the two returned values (ex. "WAL-1234567")
SUPPORTING DETAILS
The ability to identify the supplier from a URL will ALWAYS be in between "www." and ".com" - the beginning portion of the URL. This syntax will always be constant and true.
Context Examples:
<supplier><supplier><supplier><supplier><supplier><supplier><supplier><supplier><supplier><supplier><supplier><supplier>www.supplier.com
http://www.supplier.com
https://www.supplier.com
Content Examples:
<item#>www.walmart.com/ip/ITEM#
"walmart" identifies as "WAL"
<item#>https://www.samsclub.com/sams/ITEM#.ip
"samsclub" identifies as "SAM"
<item#>https://www.costco.com/.product.ITEM#.html
"costco" identifies as "COS"
As alluded to above, the function would then reference a secondary array based on:
- a particular supplier's name, and then
- recognize that supplier's syntax to know where to extract the specific item#
SPECIFIC ITEM# LOCATION
The exact location of the suppliers' item# appear in the examples provided above (Content Examples).
I have what appears to be working solutions for Walmart and Costco.
With Sam's Club however, I get mixed results*. On the referenced Excel table above, Examples 6 & 7 return inconsistent results. The output should only be the supplier prefix, hyphen, item# (Ex. SAM-1234567).
Note - the correct SKU output for Example 6 should be: SAM-prod5380361 because that's what appears between the last forward slash and ".ip"
What modification to this function would target only what appears between the last foward slash and ".ip"?
PUTTING IT ALTOGETHER
Functions are not my strong suit but I try my best to understand what they do and with the help of this community, I've been successful in piecing together what works for previous projects.
Below is a function that successfully worked for creating hyperlinks based on evaluating the name of a carrier in the URL. I believe that in this function solves the question about how to identify the supplier in order to determine the supplier prefix but I need help tying it altogether to go a step further and properly concatenate a perfect SKU just by evaluating a URL.
Code:
=IF(A5<>"",VLOOKUP(IF(ISNUMBER(FIND("www.",A5)),MID(A5,FIND("www.",A5)+4,IF(ISNUMBER(FIND(".com",A5,9)),FIND(".com",A5,9),LEN(A5)+1)-FIND("www.",A5)-4),MID(A5,FIND("//",A5)+2,IF(ISNUMBER(FIND("/",A5,9)),FIND("/",A5,9),LEN(A5)+1)-FIND("//",A5)-2)),SUPP_PREFIX,2,0)
My attempts can be seen on the "Reference" tab and the two named lists I've created there; "SUPP_PREFIX" and "SUPP_ITEM".
I see a flaw right away in that in the "Reference" tab specific cell references are coded in and I just don't know how to make that "neutral" or "variable" for a lack of better words.
Excel 2013 32 bit | ||||
---|---|---|---|---|
A | B | |||
1 | SUPPLIER | SUPP CODE | ||
2 | walmart | WAL | ||
3 | samsclub | SAM | ||
4 | costco | COS | ||
5 | ||||
6 | ||||
7 | ||||
8 | ||||
9 | ||||
10 | SUPP CODE | SUPP FUNCTION | ||
11 | WAL | TRIM(RIGHT(SUBSTITUTE(A1,"/",REPT(" ",LEN(A1))),LEN(A1))+0) | ||
12 | SAM | LEFT(TRIM(RIGHT(SUBSTITUTE(A1,"/sams/",REPT(" ",20)),20)),LEN(TRIM(RIGHT(SUBSTITUTE(A1,"/sams/",REPT(" ",20)),20)))-3) | ||
13 | COS | LEFT(TRIM(RIGHT(SUBSTITUTE(A1,".product.",REPT(" ",20)),20)),LEN(TRIM(RIGHT(SUBSTITUTE(A1,".product.",REPT(" ",20)),20)))-5) | ||
REFERENCE |
I hope this write-up is chocked full of details to clearly express what I need done and I'm happy to actively engage and try solutions you propose.
Thanks!</item#></item#></item#></supplier></supplier></supplier></supplier></supplier></supplier></supplier></supplier></supplier></supplier></supplier></supplier></insert>
Last edited: