首页 > 解决方案 > 如何在范围上使用 LEFT() 函数

问题描述

我想返回以“Total”开头的单元格的引用。

示例行 (A1:A4):

Students
Lecturers
Tutors
Total

使用=MATCH("Total",A$1:A$10,0)返回 4,但在实际数据中,A4 中的值将根据内容为“Total XZY”,因此我只需要比较单元格的前 5 个字符。

使用=MATCH("Total",LEFT(A$1:A$10,5),0)返回#VALUE!错误。当我进入函数编辑器窗口时,我可以看到公式正在被正确评估并得到 4,但它没有返回这个。图片附在下面。

为什么会发生这种情况,请问我怎样才能达到预期的结果?

从公式窗口中

标签: excelexcel-formula

解决方案


You are on the right track, the only thing you missed is that as this is an array and it will not work with a regular function. Try pressing Ctrl+Shift+Enter when you have created your MATCH function. It will look like this in the formula bar:{=MATCH("Total",LEFT($A$2:$A$6,5),0)} (Substitute your range with whatever range desired)


推荐阅读