sil*_*kid 2 excel excel-formula
我有两张excel床单
下面是两张纸的一个例子
sheet1
a 1
b 2
d 1
e 3
g 1
sheet2
a
b
c
d
e
f
Run Code Online (Sandbox Code Playgroud)
我想在公式2的b1中放入一个公式并将其向下拖动,以便生成的图纸2为
sheet2
a 1
b 2
c 0
d 1
e 3
f 0
explanation : - a = 1 because same value in book1
b = 2 because same value in book1
c = 0 because c does not exist in book1
d = 1 because same value in book1
e = 3 because same value in book1
f = 0 because f does not exist in book1
Run Code Online (Sandbox Code Playgroud)
我可以在表2的b栏中使用什么公式?
if(),iserror()和vlookup()的组合将是您最好的选择.
假设sheet1中的数据位于名为"refdata"的范围内,
=IF(ISERROR(VLOOKUP(A1,refdata,2,FALSE)),0,VLOOKUP(A1,refdata,2,FALSE))
Run Code Online (Sandbox Code Playgroud)
应该做你需要的(其中A1是包含你想要匹配的数据的单元格)