0

我正在尝试在 2 个电子表格之间进行 vlookup。其中一个电子表格有多个重复项...例如:

我在电子表格 1 中有:

Column A              Column B Column C Column D Column E
---------------------------------------------------------

cs_no             Alarmnet1 Alarmnet2 Alarmnet3 Alarmnet4
---------------------------------------------------------

    FLA013791    
    FLA013791
    FLA013791
    FLA013791
    FLA017564
    FLA017564
    FLA018638
    FLA018638
    FLA018638
    89517190
    89517190
    89517191
    89517192
    89517192
    FLA012274
    FLA012274
    FLA013334
    FLA018635
    FLA018635

我必须将 Alarmnet 代码放在第二张纸的所需空格中

在第二个我有:

Column A Column B
-----------------

cs-no                    ItemNum
-----------------------------------


    89517190       AN547
    89517191       AN547
    89517192       AN547
    89517193       AN583
    89517194       AN583
    89517195       AN583
    FLA012274      AN547
    FLA013334      AN547
    FLA013791      ALARMNETGTC3
    FLA013791      AN548
    FLA016009      AN548
    FLA016927        AN548
    FLA017564        ALARMNETGTC3
    FLA017564        AN548
    FLA017974        AN548
    FLA018075        AN548
    FLA018316        AN548
    FLA018635        AN547
    FLA018636        AN547
    FLA018637        AN547
    FLA018638     ALARMNETGTC3
    FLA018638     AN549
    FLA018639     AN547
    FLA018640       AN547
    FLA018641       AN547
    FLA018642     AN547
    FLA018644       AN547
    FLA018645       AN547
    FLA018647       AN548
    FLA018647       AN560
    FLA018647       AN564
    FLA018648     AN547
    FLA018649       AN547
    FLANT10897      AN547
    FLANT10897      AN554
    FLT43270      AN547

如果有人可以帮助我...会很酷...

4

1 回答 1

1

One method I have used here -

Place a formula to the left of the duplicate and append a number to it

=If(B2=B1,B2+(A1+"1"),B2+"1")

Basically the formula states if the value is a duplicate, add 1 to it, else make it the first value appended to the end of the value.

And change your vlookup to process each value or be null if no secondary is found

=If(IsError(Vlookup(A1+Right(B$1, 1),'Sheet2'!A:C,3,false))=true,"",Vlookup(A1+Right(B$1, 1),'Sheet2'!A:C,3,false))

Right(B$1, 1) pulls the number off the end of the AlarmNet1 or whatever to look for the 1st through 4th values. B1 should point to that cell and be a static reference too.

If that doesn't work for your situation let me know and I can adjust my answer.

于 2013-04-11T16:45:10.290 回答