【问题标题】:How to filter Excel columns values by Ms-excel formula?如何通过 Ms-excel 公式过滤 Excel 列值?
【发布时间】:2011-03-01 09:26:02
【问题描述】:

我想从 Data 下面获取过滤列字符串。

                    URL                          PreFix              OutPut             ConcatStrings
────────────────────────────────────────────────────────────────────────────────────────────────────────────────
    http://AbCD.com/grouponorange-county    |     Deals   |    orangecounty |    Dealsorangecounty

在,
Column-1第一列有一个URL字符串。
Column-2 这里有固定词 ex。交易或任何固定字符串
Column-3 希望在此“http://AbCD.com/groupon”字符串之后获取字符串
                有橙色国家,然后删除所有特殊字符,所以这里的输出是橙色国家。
Coulmn-4 ConcatString " [Column-2] + [Column-3] "

如何在 Microsoft Excel 工作表中进行操作。

【问题讨论】:

  • 非常感谢@Grzegorz_Oledzki 的修改。

标签: excel excel-2007 excel-formula


【解决方案1】:

第 4 列:使用公式 =B:B&C:C

第 3 列:如果您始终使用相同的主机名,则可以使用:

=SUBSTITUTE(A:A,"http://AbCD.com/groupon","")

如果它有不同的主机名,请使用:

=RIGHT(A:A,LEN(A:A)-FIND("groupon",A:A)-LEN("groupon")+1)

(编辑)使用Alt+F11 进入VBA,转到Insert > Module,然后将其粘贴到:

Public Function remove_special_characters(s As String) As String
    ' based on code by Aaron Blood posted here:
    ' http://www.ozgrid.com/forum/showthread.php?t=55082&page=1

    Dim cur_char As String
    Dim i As Long

    For i = 1 To Len(s)
        cur_char = Mid(s, i, 1)
        If cur_char Like "[A-Za-z0-9]" Then
            remove_special_characters = remove_special_characters & cur_char
        End If
    Next i
End Function

然后您可以在 Excel 中使用 =remove_special_characters() 作为上述函数的包装器。

【讨论】:

  • 感谢@KyleNZ,但另外,需要从 Column-3 中删除特殊符号,如“-,_,#,@,$ 等。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-01-09
  • 1970-01-01
  • 2020-08-27
相关资源
最近更新 更多