有人可以告诉我为什么第二个IF语句在下面的代码中不起作用吗?
我基本上需要做三件事;
我只能让两个声明工作......
= IF(H8 = 0,(D8)&“,”&(E8)&“,”&(F8)&“和”&(G8),(IF(G8 = 0) ,(D8)&“,”&(E8)&“和”&(F8),(D8)&“,”&(E8)&“,”&(F8)& “,”&(G8)&“和”&(H8))))
我的行看起来像这样: D =蓝莓E =小红莓F =黑电流G =草莓H = gojiberries
请帮忙
亚历
答案 0 :(得分:3)
这将仅返回非空白单元格值的串联,并在值之间使用逗号,除非下一个单元格为空,在这种情况下,逗号将替换为" and "
。
=D8&IF(E8<>"",IF(F8<>"",", "," and "),)&E8&IF(F8<>"",IF(G8<>"",", "," and "),)&F8&IF(G8<>"",IF(H8<>"",", "," and "),)&G8&IF(H8<>""," and "&H8,"")
答案 1 :(得分:1)
尝试使用此版本
=D8&", "&E8&", "&F8&IF(G8=0,"",", "&G8)&IF(H8=0,"",", "&H8)