|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
要不试试直接VBA自定义CONCAT函数来使用
1.alt+f11 进入VBA编辑窗口
2.菜单栏-插入-模块
3.在模块里输入:
- Function CONCAT(range As range, Optional delimiter As String = "") As String
- Dim cell As range
- Dim result As String
- result = ""
-
- ' 遍历范围内的每个单元格
- For Each cell In range
- ' 如果单元格不为空,则将其值添加到结果中
- If cell.Value <> "" Then
- result = result & cell.Value & delimiter
- End If
- Next cell
-
- ' 如果指定了分隔符,去掉最后一个多余的分隔符
- If delimiter <> "" And result <> "" Then
- result = Left(result, Len(result) - Len(delimiter))
- End If
-
- ' 返回合并后的结果
- CONCAT = result
- End Function
复制代码
4.alt+Q 退出编辑器,然后再使用
- JG2=CONCAT(IF(--A1:JF1=1,A2:JF2,""))
复制代码 这样应该就可以用了 |
|