1

I have a problem at work where we would take an old SKU number and replace it with a new one. Unfortunately, there are instances where the new SKU number replacing an old SKU number would eventually become an 'old' SKU itself and would be phased out. Below is an example.

    Old Sku   New SKU
    06223     34162
    06223     34162
    06553     01925
    06557     19100
    06557     19100
    06573     11443
    06573     11443
    51095     06223
    51095     06223

With the way I need it formatted for work, I need the three different SKU's to become 1 unique SKU, so 06223, 34162, and 51095 would equal a new SKU # of 12345.

This is what I would need it to look like

    Old Sku New SKU Unique SKU
    06223   34162   1
    06223   34162   1
    06223   34162   1
    06553   01925   2
    06557   19100   3
    06557   19100   3
    06573   11443   4
    06573   11443   4
    51095   06223   1
    51095   06223   1

I am not too familiar with the indirect function but I have been told I may need to use that. I appreciate all the help. Thank you!

EDIT @CallumDA this is what I am getting with your code

    Old SKU         New SKU         All New SKU
    00080           00080           1
    00606           24264           2
    00606           98952           3
    00644           16814           4
    00721           58008           5
    00753           01929           6

Rows 2 and 3 should have 2 in the all new sku

4

1 回答 1

2

将此公式放入C2并向下拖动

=IFERROR(VLOOKUP(IFERROR(VLOOKUP(B3,$A$1:$B1,2,0),B2),$B$1:$C1,2,0),MAX($C$1:C1)+1)

看起来像这样:
库存单位

正如我在评论中建议的那样,您也可以使用更简单的解决方案:

=IFERROR(VLOOKUP(B2,$A$2:$B$11,2,0),B2)

刚刚获得最新的新 SKU——像这样:(在“替代”列中)

在此处输入图像描述

更新

由于您更新了数据,因此您具有一对多关系以及多对一关系。这是更新的方法和公式。B3为这种情况更改了单元格中的值并将其拆分为两列以方便:

在此处输入图像描述

中的公式D2为:

=VLOOKUP(INDEX($A$2:$A$11,MATCH(IFERROR(VLOOKUP(B2,$A$2:$B$11,2,0),B2),$B$2:$B$11,0)),$A$2:$B$11,2,0)

同样forE2是:

=IFERROR(VLOOKUP(D2,$D$1:$E1,2,0),MAX($E$1:E1)+1)

您更新的数据现在如下所示:

在此处输入图像描述

于 2017-02-06T16:14:05.480 回答