Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google sheets 自定义条件格式,如何在单元格中使用基于字符串数量的条件_Google Sheets - Fatal编程技术网

Google sheets 自定义条件格式,如何在单元格中使用基于字符串数量的条件

Google sheets 自定义条件格式,如何在单元格中使用基于字符串数量的条件,google-sheets,Google Sheets,我想用自定义函数格式化单元格。 单元格的内容如下所示,但不包括: Cell_1: "String1 String2 String3" Cell_2: "" Cell_3: "String1 String2 String3 String4 String5 String6" 如果其中至少有5个字符串,用空格分隔,则应为true语句 我尝试使用这样的自定义脚本,因为我无论如何都在调用此单元格中的函数,在返回值之前,我还可以设置格式: var self = SpreadsheetApp.getActi

我想用自定义函数格式化单元格。 单元格的内容如下所示,但不包括:

Cell_1: "String1 String2 String3"
Cell_2: ""
Cell_3: "String1 String2 String3 String4 String5 String6"
如果其中至少有5个字符串,用空格分隔,则应为true语句

我尝试使用这样的自定义脚本,因为我无论如何都在调用此单元格中的函数,在返回值之前,我还可以设置格式:

var self = SpreadsheetApp.getActiveSheet().getActiveCell();
self.setFontWeight("normal");
if(returnValue.length>=5){
  self.setFontWeight("bold");
}
return returnValue.sort().join(" ");
但我有一个问题,你无权打电话给setFontWeight Exeption。经过一点研究,我发现cunstom脚本根本不允许使用cange格式。好的但是如何使用自定义格式条件呢

这样的事情可能吗

=If(Split(?inputRange?;" ").length>=5;True;False)
如果是,如何以正确的格式获取范围,以及需要哪个函数来获取字符串量

我还尝试为此编写一个自定义函数:

function customFormat(input){
if(input.length>=5)
   return true;
}
return false;
像自定义条件一样调用:

=customFormat(range)
这就像我不能使用自定义函数,我没有得到积极的结果,甚至比我总是返回真


如果你对如何实现这一目标有一些想法,我将不胜感激

假设这三个单元格位于A1:A3中

使用公式将条件格式应用于该范围

=COUNTA(SPLIT(A1, " ")) >= 5