Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 4999|回复: 3

[已解决]>>>>>>大神求助!!!!! (急阿折磨一晚)資料配對與自動填寫

[复制链接]
发表于 2014-6-10 21:05 | 显示全部楼层 |阅读模式
本帖最后由 IFORGOTMYCODE 于 2014-6-10 21:44 编辑

各位大神好
想請教Excel,資料配對自動填寫,該如何進行
假設資料如下,我該如何撰寫判斷式


→  若是 F行放置的"名稱",有在A行出現過, 則數1 數2 = 該 dataname 對應的 num1 num2
→  若沒有對應  則出現 0

---感謝了!!!!
        A              B          C        D    E     F              G        H
datanamenum1num2名稱數1數2
AAA
68
2380
AAA682380
AAB
61
1902
AAB
AAC
59
1498
AAE
AAD
44
225
AEF
AAE
33
55
ZZZ00
AAF
22
44
AAG
11
22
ABA
10
21
ACA
10
20
ADA
9
19
AEF
8
18

最佳答案
2014-6-10 21:30
  1. Sub t()
  2.   With Range("G2:H6")
  3.     .Formula = "=if(iserror(vlookup($F2,$A:$C,column(B1),0)),0,vlookup($F2,$A:$C,column(B1),0))"
  4.     .Value = .Value
  5.   End With
  6. End Sub
复制代码
For Excel 2003
excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
发表于 2014-6-10 21:27 | 显示全部楼层
  1. Sub t()
  2.   With Range("G2:H6")
  3.     .Formula = "=iferror(vlookup($F2,$A:$C,column(B1),0),0)"
  4.     .Value = .Value
  5.   End With
  6. End Sub
复制代码
回复

使用道具 举报

发表于 2014-6-10 21:30 | 显示全部楼层    本楼为最佳答案   
  1. Sub t()
  2.   With Range("G2:H6")
  3.     .Formula = "=if(iserror(vlookup($F2,$A:$C,column(B1),0)),0,vlookup($F2,$A:$C,column(B1),0))"
  4.     .Value = .Value
  5.   End With
  6. End Sub
复制代码
For Excel 2003
回复

使用道具 举报

发表于 2014-6-10 23:11 | 显示全部楼层
班委出手了…………
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-5-20 22:40 , Processed in 0.267951 second(s), 12 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表