Manos Krokos
Manos Krokos

Reputation: 113

Fill category column based on SKU lookup

I have a Google Sheet with two worksheets.

The first worksheet (Sheet1) contains a list of products with multiple columns. The columns of interest are F and R:

The product SKU consists of two sections. The first one is the category indicator and the second one (after the dash) is the actual product number.

The second one (Sheet2) contains a list of categories:

What I would like to do is autopopulate the category column (R) of the first worksheet with the category names found on the second worksheet based on the product SKU. Since each product belongs to a master category and to one or more subcategories, the category should be populated like this:

Φουλάρια Πασμίνες>Βαμβακερά>Classic

Ie, category and subcategories separated by ">"

Ideally, I would like all product categories to be populated like this:

Φουλάρια Πασμίνες|Φουλάρια Πασμίνες>Βαμβακερά|Φουλάρια Πασμίνες>Βαμβακερά>Classic

because that would assign each product to the main category and to all subcategories.

Here is the Google Sheet: https://docs.google.com/spreadsheets/d/1qY1ry3rJbAexeTy7Y31ueKR9uaYKLXnu1jGbZCsqK1U/edit?usp=sharing

Upvotes: 1

Views: 227

Answers (1)

marikamitsos
marikamitsos

Reputation: 10573

Please try the following

=ArrayFormula(IFERROR(VLOOKUP(REGEXEXTRACT(F3:F268,"(.*)-"),
                  {U3:U98,V3:V98&"|"&V3:V98&" >"&W3:W98&"|"&V3:V98&" >"&W3:W98&" >"&X3:X98},2,0)))

(do adjust ranges to your needs)

enter image description here

(καλές δουλειές)

Upvotes: 2

Related Questions