微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

合并单元格,除非单元格包含特定文本

如何解决合并单元格,除非单元格包含特定文本

我有一个 Excel 电子表格,其中有 7 个单元格(在一列中),其中包含数据,这些是 C13 到 C19 我有一个公式将这些单元格中的所有数据组合在一起并将其放入一个单元格中,这个公式是 =C13&","&C14&","&C15&","&C16&","&C17&"," &C18&","&C19 并且工作正常。但是,我可以更改此公式以遗漏包含文本“nothing else carby”的任何单元格吗?

解决方法

您可以在 Excel 2019 中使用:

private UserAccount _userAccount;
public UserAccount CurrentUserAccount
{
    get { return _userAccount; }
    set
    {
        if (_userAccount != null)
            _userAccount.PropertyChanged -= OnUserAccountPropertyChanged;
        _userAccount = value;
        if (_userAccount != null)
            _userAccount.PropertyChanged += OnUserAccountPropertyChanged;
        OnPropertyChanged(nameof(CurrentUserAccount));
    }
}

private void OnUserAccountPropertyChanged(object sender,PropertyChangedEventArgs e) =>
    OnPropertyChanged(null);

如果“Nothing else carby”可以是单元格值内的子字符串,请尝试:

=TEXTJOIN(",",IF(C13:C19<>"Nothing else carby",C13:C19,""))

通过CtrlShift回车

确认 ,

公式不应那么长,如您所见:

processed = set()
if isinstance(statements,list):
    processed.update(statements)
else:
    processed.add(statements)

(出于可读性原因,我只是使用了“Nothing”而不是整个词。)

参数说明:

=TEXTJOIN(",TRUE,IF(C13:C19="Nothing","",C13:C19))

使用的数据:

"," : delimiter: between every cell content,a comma is added.
TRUE : treatment of blank cells (don't put them).
IF (...) : In case cell content is "Nothing",put an empty string. 
           In combination with the previous parameter,just one comma will be put in the result:
           "a,b,c,e,f,g" and not "a,g" (see result).

结果:

a
b
c
Nothing
e
f
g

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。