You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Google Sheets公式问题:如何将指定字符串仅填充至特定行

Google Sheets 公式修正:仅匹配指定城市时填充区域

问题场景

你使用公式 =IF(COUNTIF(P3:P300,"Liverpool"),"North West","") 试图实现:当Town列(P列)某行内容为"Liverpool"时,在Region列(V列)对应行填入"North West",否则留空。但当前公式会将"North West"填充至所有行,仅期望第3、5行显示该内容。

当前错误效果:

NameTownRegion
School 1SalisburyNorth West
School 2LeedsNorth West
School 3LiverpoolNorth West
School 4BirminghamNorth West
School 5LiverpoolNorth West

错误原因

COUNTIF(P3:P300,"Liverpool") 的作用是统计P3到P300范围内包含"Liverpool"的单元格总数,只要该范围内存在至少一个匹配项,就会返回大于0的数值。而IF函数会将所有非0数值判定为TRUE,因此所有行都会返回"North West"。

修正方案

需要针对单行单元格进行判断,而不是统计整个区域。使用以下公式:

=IF(P3="Liverpool","North West","")

将该公式输入到V3单元格,然后下拉填充至V300即可。

修正后效果

NameTownRegion
School 1Salisbury
School 2Leeds
School 3LiverpoolNorth West
School 4Birmingham
School 5LiverpoolNorth West

内容的提问来源于stack exchange,提问作者ShaqSD

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.24 01:43:14