简单的vlookup函数从预期行以下的行返回值

时间:2019-10-13 14:58:11

标签: google-sheets syntax google-sheets-formula gs-vlookup

我创建了一个简单的Google电子表格

|   | A   | B |
|---|-----|---|
| 1 | CAD | 4 |
| 2 | BTC | 3 |
| 3 | USD | 2 |

我期望=vlookup("CAD",A1:B3,2)返回“ 4”,但它返回“ 3”。我的问题是:这背后的逻辑是什么?

  • =vlookup("CAD",A1:B3,2,FALSE)在Google表格中返回4。
  • =vlookup("CAD",A1:B3,2)在LibreOffice中返回4。

查看随附的图像。

vlookup in google sheets vs in libreoffice

1 个答案:

答案 0 :(得分:1)

嗯,这里无话可说。做这样的vlookup:

=VLOOKUP("CAD", A1:B3, 2)

并且不包括第4个vlookup参数,该公式会将第4个参数默认为TRUE1,因此它与以下内容基本相同:

=VLOOKUP("CAD", A1:B3, 2, 1)

=VLOOKUP("CAD", A1:B3, 2, TRUE)

,通过将第四个参数设为1TRUE,我们告诉vlookup运行 approximate 模式而不是 exact 模式。确切的模式将是以下任何一种:

=VLOOKUP("CAD", A1:B3, 2, )

=VLOOKUP("CAD", A1:B3, 2, 0)

=VLOOKUP("CAD", A1:B3, 2, FALSE)

通常,您将需要精确的模式,除非您需要在两个其他数字(例如 https://webapps.stackexchange.com/a/123730/186471

)之间查找数字

并解释为什么您寻求3时会为BTC获得价值CAD的原因是因为 B C 之前用字母