excel - Excel Formula Vlookup issue
问题描述
I have 2 excel sheets ("sheet 1, sheet 2").
Sheet 1 and Sheet 2 have "product #" in column A and "price" in column C. I'm trying to write a formula that would allow Sheet 1 to lookup on sheet 2 if there is a Product # match In column A and if there is a product # match then to update on Sheet 1 Column C (Price) the product price from sheet 2. If there is no Match of product # from sheet 2 then to leave the price on sheet 1 alone.
I'm using this formula which returns a "0" on an error but I can't figure out how to modify it to leave price alone when there's no product # found.
=IFERROR(VLOOKUP(A2,updated!A:C,3,FALSE),0)
Thanks
解决方案
您想为此使用INDEX/MATCH
:
将以下公式放入列中C
并向下填充 =IFERROR(IF(INDEX(Sheet2!B:B,MATCH(A2,Sheet2!A:A,0))=Sheet1!B2,B2,INDEX(Sheet2!B:B,匹配(A2,Sheet2!A:A,0))),“”)
MATCH
会发现,Sheet2 上具有相同产品 ID 的行,将INDEX
返回匹配的价格。如果它与 Sheet1 上的值匹配,则公式将返回 Sheet1 列中的值B
。如果不是,它将从 Sheet2 返回价格
推荐阅读
- reactjs - 在 react 16 中使用相同的键会导致警告,但仍然显示所有项目
- javascript - 使用 javascript 在关闭选项卡或按钮单击时删除/更新 cookie
- elasticsearch - 我在使用@Query注解的方法中声明了查询,但是无法运行测试应用程序,代码如下
- google-cloud-storage - 如何使用访问权限和密钥访问 Google Cloud Storage
- java - CircleImageView 错误:来自 Firebase 存储的 Picasso.load() 上的 java.lang.IllegalArgumentException
- javascript - 如何在 Kotlin/JS 中编写 MongoDB 聚合
- ubuntu - 使用域名而不是 IP 地址访问我的网站时连接被拒绝(digitalocean droplet 上的简单 nginx 设置)
- python - 气流工作者 - 连接断开:IncompleteRead(读取 0 字节)
- javascript - 上传前预览 PDF/图像文件
- android - 如何检测并停止应用程序升级到新版本的android