带 AND 条件的嵌套 IF 语句和多个嵌套 QUERY
Nested IF statements with AND condition and multiple nested QUERY
在我的 Google Sheet 的 "Process Validation" 选项卡中,我有一个数据验证单元格,其中有多个选项可供选择。
所选选项会触发 "Master Extraction" 选项卡中的 QUERY
。
为了做到这一点 "fool-proof" 我在 "Process Validation" 选项卡中添加了几列带有复选框以标记流程每个阶段的完成(例如每周活动 CSV 导出 - 一个阶段这要求用户将提到的报告导出为 CSV)。
如果前一阶段尚未完成(未选中复选框),则用户无法继续提取下一个文件。
我需要的是:
如果用户从数据验证中选择 "Weekly Campaign" 并且源文件和每周活动字段尚未填写,则显示以下消息:
"Please, clarify if the 'Source File' and 'Weekly Campaign ID' fields
in the 'Process Validation' tab have been filled correctly."
如果用户选择其他报告 - 例如。 "Update lead address",未完成 "Weekly Campaign" 报告的所有 4 个阶段(未选中所有 4 个复选框(= TRUE))将显示以下消息:
"Please, clarify if the 'Weekly Campaign CSV Export', 'Weekly Campaign
CSV Export Save', 'Weekly Campaign SF Append' and 'Weekly Campaign
Success Error TD Upload' processes have been completed."
如果前面过程的所有阶段都已完成,则应触发所需的 QUERY
。
到目前为止我得到的是:
=IF(IF(AND(fileToExtract = "Weekly Campaign",
sourceFile <> "",
weeklyCampaignID <> ""),
QUERY(QUERY({sourceFile_dataRange},
"SELECT Col" & MATCH("Lead ID",sourceFile_labelRange,FALSE)),
"SELECT Col1, '" & weeklyCampaignID & "', 'Sent'
WHERE Col1 IS NOT NULL
LABEL '" & weeklyCampaignID & "' 'Campaign ID',
'Sent' 'Status'",1),
"Please, clarify if the 'Source File' and 'Weekly Campaign ID' fields in the 'Process Validation' tab have been filled correctly."),
IF(IF(AND(fileToExtract = "Update lead address",
weeklyCampaign_CSV_Export = TRUE,
weeklyCampaign_CSV_Export_Save = TRUE,
weeklyCampaign_SF_Append = TRUE,
weeklyCampaign_Success_Error_TD_Upload = TRUE),
QUERY(QUERY({sourceFile_dataRange},
"SELECT Col" & MATCH("Lead ID", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Street", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("City", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("State/Province", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Zip/Postal Code", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Country (RB)", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Country", sourceFile_labelRange,FALSE),1),
"SELECT Col1,
Col2,
Col3,
Col4,
Col5,
Col6,
Col7
WHERE Col1 IS NOT NULL", 1),
"Please, clarify if the 'Weekly Campaign CSV Export', 'Weekly Campaign CSV Export Save', 'Weekly Campaign SF Append' and 'Weekly Campaign Success Error TD Upload' processes have been completed.")))
上面的公式导致 #VALUE!
错误 - Function IF parameter 1 expects boolean values. But 'Please, clarify if the 'Source File' and 'Weekly Campaign ID' fields in the 'Process Validation' tab have been filled correctly.' is a text and cannot be coerced to a boolean.
.
当我尝试 运行 它们像这样分开时:
=IF(IF(AND(fileToExtract = "Weekly Campaign",
sourceFile <> "",
weeklyCampaignID <> ""),
QUERY(QUERY({sourceFile_dataRange},
"SELECT Col" & MATCH("Lead ID",sourceFile_labelRange,FALSE)),
"SELECT Col1, '" & weeklyCampaignID & "', 'Sent'
WHERE Col1 IS NOT NULL
LABEL '" & weeklyCampaignID & "' 'Campaign ID',
'Sent' 'Status'",1),
"Please, clarify if the 'Source File' and 'Weekly Campaign ID' fields in the 'Process Validation' tab have been filled correctly."),"Dull")
或者像这样:
=IF(IF(AND(fileToExtract = "Update lead address",
weeklyCampaign_CSV_Export = TRUE,
weeklyCampaign_CSV_Export_Save = TRUE,
weeklyCampaign_SF_Append = TRUE,
weeklyCampaign_Success_Error_TD_Upload = TRUE),
QUERY(QUERY({sourceFile_dataRange},
"SELECT Col" & MATCH("Lead ID", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Street", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("City", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("State/Province", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Zip/Postal Code", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Country (RB)", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Country", sourceFile_labelRange,FALSE),1),
"SELECT Col1,
Col2,
Col3,
Col4,
Col5,
Col6,
Col7
WHERE Col1 IS NOT NULL", 1),
"Please, clarify if the 'Weekly Campaign CSV Export', 'Weekly Campaign CSV Export Save', 'Weekly Campaign SF Append' and 'Weekly Campaign Success Error TD Upload' processes have been completed."),"EVEN DULLER")
我分别得到以下 #VALUE!
个错误:
Error
Function IF parameter 1 expects boolean values. But 'Please, clarify if the 'Source File' and 'Weekly Campaign ID' fields in the 'Process Validation' tab have been filled correctly.' is a text and cannot be coerced to a boolean.
并且:
Error
Function IF parameter 1 expects boolean values. But 'Please, clarify if the 'Weekly Campaign CSV Export', 'Weekly Campaign CSV Export Save', 'Weekly Campaign SF Append' and 'Weekly Campaign Success Error TD Upload' processes have been completed.' is a text and cannot be coerced to a boolean.
合并后几乎是相同的错误。
我该如何解决这个问题?
P.S.
如果您需要一些虚拟数据,请务必告诉我,但请记住,我有公司安全限制,禁止我与公司以外的任何人共享任何 sheet。
第一个 IF
的参数放错地方了。
而不是:
=IF(IF(AND(fileToExtract = "Weekly Campaign",
sourceFile <> "",
weeklyCampaignID <> ""),
QUERY(QUERY({sourceFile_dataRange}, ect...
并且:
IF(IF(AND(fileToExtract = "Update lead address",
weeklyCampaign_CSV_Export = TRUE,
weeklyCampaign_CSV_Export_Save = TRUE,
weeklyCampaign_SF_Append = TRUE,
weeklyCampaign_Success_Error_TD_Upload = TRUE),
QUERY(QUERY({sourceFile_dataRange}, ect...
应该是:
=IF(fileToExtract = "Weekly Campaign",
IF(AND(sourceFile <> "",
weeklyCampaignID <> ""),
QUERY(QUERY({sourceFile_dataRange}, ect...
并且:
IF(fileToExtract = "Update lead address",
IF(AND(weeklyCampaign_CSV_Export = TRUE,
weeklyCampaign_CSV_Export_Save = TRUE,
weeklyCampaign_SF_Append = TRUE,
weeklyCampaign_Success_Error_TD_Upload = TRUE),
QUERY(QUERY({sourceFile_dataRange}, ect...
整个QUERY
是这样的:
=IF(fileToExtract = "Weekly Campaign",
IF(AND(sourceFile <> "",
weeklyCampaignID <> ""),
QUERY(QUERY({sourceFile_dataRange},
"SELECT Col" & MATCH("Lead ID",sourceFile_labelRange,FALSE)),
"SELECT Col1, '" & weeklyCampaignID & "', 'Sent'
WHERE Col1 IS NOT NULL
LABEL '" & weeklyCampaignID & "' 'Campaign ID',
'Sent' 'Status'",1),
"Please, clarify if the 'Source File' and 'Weekly Campaign ID' fields in the 'Process Validation' tab have been filled correctly."),
IF(fileToExtract = "Update lead address",
IF(AND(weeklyCampaign_CSV_Export = TRUE,
weeklyCampaign_CSV_Export_Save = TRUE,
weeklyCampaign_SF_Append = TRUE,
weeklyCampaign_Success_Error_TD_Upload = TRUE),
QUERY(QUERY({sourceFile_dataRange},
"SELECT Col" & MATCH("Lead ID", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Street", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("City", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("State/Province", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Zip/Postal Code", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Country (RB)", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Country", sourceFile_labelRange,FALSE),1),
"SELECT Col1,
Col2,
Col3,
Col4,
Col5,
Col6,
Col7
WHERE Col1 IS NOT NULL", 1),
"Please, clarify if the 'Weekly Campaign CSV Export', 'Weekly Campaign CSV Export Save', 'Weekly Campaign SF Append' and 'Weekly Campaign Success Error TD Upload' processes have been completed.")))
在我的 Google Sheet 的 "Process Validation" 选项卡中,我有一个数据验证单元格,其中有多个选项可供选择。
所选选项会触发 "Master Extraction" 选项卡中的 QUERY
。
为了做到这一点 "fool-proof" 我在 "Process Validation" 选项卡中添加了几列带有复选框以标记流程每个阶段的完成(例如每周活动 CSV 导出 - 一个阶段这要求用户将提到的报告导出为 CSV)。 如果前一阶段尚未完成(未选中复选框),则用户无法继续提取下一个文件。
我需要的是:
如果用户从数据验证中选择 "Weekly Campaign" 并且源文件和每周活动字段尚未填写,则显示以下消息:
"Please, clarify if the 'Source File' and 'Weekly Campaign ID' fields in the 'Process Validation' tab have been filled correctly."
如果用户选择其他报告 - 例如。 "Update lead address",未完成 "Weekly Campaign" 报告的所有 4 个阶段(未选中所有 4 个复选框(= TRUE))将显示以下消息:
"Please, clarify if the 'Weekly Campaign CSV Export', 'Weekly Campaign CSV Export Save', 'Weekly Campaign SF Append' and 'Weekly Campaign Success Error TD Upload' processes have been completed."
如果前面过程的所有阶段都已完成,则应触发所需的 QUERY
。
到目前为止我得到的是:
=IF(IF(AND(fileToExtract = "Weekly Campaign",
sourceFile <> "",
weeklyCampaignID <> ""),
QUERY(QUERY({sourceFile_dataRange},
"SELECT Col" & MATCH("Lead ID",sourceFile_labelRange,FALSE)),
"SELECT Col1, '" & weeklyCampaignID & "', 'Sent'
WHERE Col1 IS NOT NULL
LABEL '" & weeklyCampaignID & "' 'Campaign ID',
'Sent' 'Status'",1),
"Please, clarify if the 'Source File' and 'Weekly Campaign ID' fields in the 'Process Validation' tab have been filled correctly."),
IF(IF(AND(fileToExtract = "Update lead address",
weeklyCampaign_CSV_Export = TRUE,
weeklyCampaign_CSV_Export_Save = TRUE,
weeklyCampaign_SF_Append = TRUE,
weeklyCampaign_Success_Error_TD_Upload = TRUE),
QUERY(QUERY({sourceFile_dataRange},
"SELECT Col" & MATCH("Lead ID", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Street", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("City", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("State/Province", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Zip/Postal Code", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Country (RB)", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Country", sourceFile_labelRange,FALSE),1),
"SELECT Col1,
Col2,
Col3,
Col4,
Col5,
Col6,
Col7
WHERE Col1 IS NOT NULL", 1),
"Please, clarify if the 'Weekly Campaign CSV Export', 'Weekly Campaign CSV Export Save', 'Weekly Campaign SF Append' and 'Weekly Campaign Success Error TD Upload' processes have been completed.")))
上面的公式导致 #VALUE!
错误 - Function IF parameter 1 expects boolean values. But 'Please, clarify if the 'Source File' and 'Weekly Campaign ID' fields in the 'Process Validation' tab have been filled correctly.' is a text and cannot be coerced to a boolean.
.
当我尝试 运行 它们像这样分开时:
=IF(IF(AND(fileToExtract = "Weekly Campaign",
sourceFile <> "",
weeklyCampaignID <> ""),
QUERY(QUERY({sourceFile_dataRange},
"SELECT Col" & MATCH("Lead ID",sourceFile_labelRange,FALSE)),
"SELECT Col1, '" & weeklyCampaignID & "', 'Sent'
WHERE Col1 IS NOT NULL
LABEL '" & weeklyCampaignID & "' 'Campaign ID',
'Sent' 'Status'",1),
"Please, clarify if the 'Source File' and 'Weekly Campaign ID' fields in the 'Process Validation' tab have been filled correctly."),"Dull")
或者像这样:
=IF(IF(AND(fileToExtract = "Update lead address",
weeklyCampaign_CSV_Export = TRUE,
weeklyCampaign_CSV_Export_Save = TRUE,
weeklyCampaign_SF_Append = TRUE,
weeklyCampaign_Success_Error_TD_Upload = TRUE),
QUERY(QUERY({sourceFile_dataRange},
"SELECT Col" & MATCH("Lead ID", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Street", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("City", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("State/Province", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Zip/Postal Code", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Country (RB)", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Country", sourceFile_labelRange,FALSE),1),
"SELECT Col1,
Col2,
Col3,
Col4,
Col5,
Col6,
Col7
WHERE Col1 IS NOT NULL", 1),
"Please, clarify if the 'Weekly Campaign CSV Export', 'Weekly Campaign CSV Export Save', 'Weekly Campaign SF Append' and 'Weekly Campaign Success Error TD Upload' processes have been completed."),"EVEN DULLER")
我分别得到以下 #VALUE!
个错误:
Error
Function IF parameter 1 expects boolean values. But 'Please, clarify if the 'Source File' and 'Weekly Campaign ID' fields in the 'Process Validation' tab have been filled correctly.' is a text and cannot be coerced to a boolean.
并且:
Error
Function IF parameter 1 expects boolean values. But 'Please, clarify if the 'Weekly Campaign CSV Export', 'Weekly Campaign CSV Export Save', 'Weekly Campaign SF Append' and 'Weekly Campaign Success Error TD Upload' processes have been completed.' is a text and cannot be coerced to a boolean.
合并后几乎是相同的错误。
我该如何解决这个问题?
P.S.
如果您需要一些虚拟数据,请务必告诉我,但请记住,我有公司安全限制,禁止我与公司以外的任何人共享任何 sheet。
第一个 IF
的参数放错地方了。
而不是:
=IF(IF(AND(fileToExtract = "Weekly Campaign",
sourceFile <> "",
weeklyCampaignID <> ""),
QUERY(QUERY({sourceFile_dataRange}, ect...
并且:
IF(IF(AND(fileToExtract = "Update lead address",
weeklyCampaign_CSV_Export = TRUE,
weeklyCampaign_CSV_Export_Save = TRUE,
weeklyCampaign_SF_Append = TRUE,
weeklyCampaign_Success_Error_TD_Upload = TRUE),
QUERY(QUERY({sourceFile_dataRange}, ect...
应该是:
=IF(fileToExtract = "Weekly Campaign",
IF(AND(sourceFile <> "",
weeklyCampaignID <> ""),
QUERY(QUERY({sourceFile_dataRange}, ect...
并且:
IF(fileToExtract = "Update lead address",
IF(AND(weeklyCampaign_CSV_Export = TRUE,
weeklyCampaign_CSV_Export_Save = TRUE,
weeklyCampaign_SF_Append = TRUE,
weeklyCampaign_Success_Error_TD_Upload = TRUE),
QUERY(QUERY({sourceFile_dataRange}, ect...
整个QUERY
是这样的:
=IF(fileToExtract = "Weekly Campaign",
IF(AND(sourceFile <> "",
weeklyCampaignID <> ""),
QUERY(QUERY({sourceFile_dataRange},
"SELECT Col" & MATCH("Lead ID",sourceFile_labelRange,FALSE)),
"SELECT Col1, '" & weeklyCampaignID & "', 'Sent'
WHERE Col1 IS NOT NULL
LABEL '" & weeklyCampaignID & "' 'Campaign ID',
'Sent' 'Status'",1),
"Please, clarify if the 'Source File' and 'Weekly Campaign ID' fields in the 'Process Validation' tab have been filled correctly."),
IF(fileToExtract = "Update lead address",
IF(AND(weeklyCampaign_CSV_Export = TRUE,
weeklyCampaign_CSV_Export_Save = TRUE,
weeklyCampaign_SF_Append = TRUE,
weeklyCampaign_Success_Error_TD_Upload = TRUE),
QUERY(QUERY({sourceFile_dataRange},
"SELECT Col" & MATCH("Lead ID", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Street", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("City", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("State/Province", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Zip/Postal Code", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Country (RB)", sourceFile_labelRange,FALSE) & ",
Col" & MATCH("Country", sourceFile_labelRange,FALSE),1),
"SELECT Col1,
Col2,
Col3,
Col4,
Col5,
Col6,
Col7
WHERE Col1 IS NOT NULL", 1),
"Please, clarify if the 'Weekly Campaign CSV Export', 'Weekly Campaign CSV Export Save', 'Weekly Campaign SF Append' and 'Weekly Campaign Success Error TD Upload' processes have been completed.")))