Google查找功能始终使用最后一个值,无论如何。

huangapple go评论57阅读模式
英文:

Google lookup function simply uses the last value no matter what

问题

Column A 中有 3 列我感兴趣。
Column A 是一列以字符串形式写出的数字列表(seven,eleven,nineteen)
Column B 是一列数字列表(7,11,19)
Cell C1 中有公式:=LOOKUP("seven",A1:A3,B1:B3)
如果 A3 中有任何内容,此公式总是返回 19
如果 A3 中没有内容,它会返回 11,只有当 A2 和 A3 都没有内容时,它才会返回 7。
查看图像描述
我理解错了什么?
谢谢

我原本期望这个测试会找到匹配的字符串并返回范围中的数字,但它总是默认跳到最后一个值。

如果我在 A3 中放入字符串 "cow",它会返回 19
查看图像描述
如果我在 A3 中放入字符串 "three",它会返回 11
查看图像描述

我还尝试过使用 VLOOKUP 和 HLOOKUP,但结果更糟糕。
我尝试在范围中使用和不使用 "$"。

这是什么样的逻辑?哈哈

英文:

I have 3 columns of interest.
Column A is a list of numbers written out as strings. (seven, eleven, nineteen)
Column B is a list of numbers as numbers. (7, 11,19)
Cell C1 has the formula: =LOOKUP("seven",A1:A3,B1:B3)
this formula always returns 19 if there is ANYTHING in A3
If there is nothing in A3, it returns 11, and only if there is nothing in A2, A3 will it return 7.
enter image description here
What am I misunderstanding?
Thanks

I was expecting the test to find the matching string and yield the number in the range but it always skips to the last value by default.

If I put a string in A3 of "cow" it yields 19
enter image description here
if I put a string in A3 of "three" it yields 11
enter image description here

I've also tried VLOOKUP and HLOOKUP with worse results.
I tried with and without "$" in ranges.

What kind of logic is this? lol

答案1

得分: 0

根据LOOKUP()文档:

LOOKUP(搜索键, 搜索范围|搜索结果数组, [结果范围])
  • LOOKUP函数只有在搜索范围或搜索结果数组中的数据已排序时才能正常工作。如果数据未排序,请使用VLOOKUP、HLOOKUP或其他相关函数。

您可以尝试在测试数据集中使用以下公式:

=xlookup("seven", A:A, B:B,)
英文:

<!-- language-all: js -->

As per LOOKUP() documentation:

LOOKUP(search_key, search_range|search_result_array, [result_range])
  • The LOOKUP function will only work properly if data in search_range
    or search_result_array is sorted
    . Use VLOOKUP, HLOOKUP, or other
    related functions if data is not sorted.

You may try this for your test dataset:

=xlookup(&quot;seven&quot;,A:A,B:B,)

huangapple
  • 本文由 发表于 2023年7月11日 00:24:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/76655632.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定