需要在Excel中合并3列 [英] need to merge 3 columns in excel

查看:77
本文介绍了需要在Excel中合并3列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3列A,B,C,我需要合并这3列,并且已经应用​​了forumala =A1&","&B1&","&C1输出为E列,我需要将输出作为D列.

I have 3 columns A,B,C and I need to merge the 3 columns and I have applied the forumala =A1&","&B1&","&C1 the output came as E column I need the output as D column.

推荐答案

以下公式将达到您想要的结果:

The following formula will achieve your desired result:

=TEXTJOIN(",",TRUE,A1:C1)

Textjoin的作用类似于连接,但可以有一个定界符作为参数,它还使您能够忽略空白单元格,第一个参数是定界符,第二个是忽略空白的标志,第三个是用于范围的标志.

Textjoin works like concatenate but can have a delimiter as an argument, also it gives you the ability to ignore blank cells, the first argument is the delimiter, the second is the flag to ignore blanks and the third is for the range.

正如评论确实提到的那样,TEXTJOIN仅适用于Office 365订阅者,一种可能的替代方法是按以下方式构建UDF,这将允许您使用上面的公式而无需Office 365订阅:

As comments do mention that TEXTJOIN is only available for Office 365 subscribers, a possible alternative would be to build your UDF as below, this will allow you to use the formula above without an Office 365 subscription:

Function TEXTJOIN(delimiter As String, ignore_empty As Boolean, rng As Range) As String
Dim compiled As String
For Each cell In rng
    If ignore_empty And IsEmpty(cell.Value) Then
        'nothing
    Else
        compiled = compiled + IIf(compiled = "", "", delimiter) + CStr(cell.Value)
    End If
Next
TEXTJOIN = compiled
End Function

这篇关于需要在Excel中合并3列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆