【问题标题】:find words in excel在excel中查找单词
【发布时间】:2012-11-14 13:54:22
【问题描述】:

你知道当你点击 control-F 来查找单词,然后当你点击 find all 时,它会给你一个包含该单词的所有单元格的列表

我们如何将其放入公式中,以便将这些结果列出在工作表中 所以说我有这张纸 1

    A     |     B  
1 apple

在第 2 页中

    A     |     B  
1 apple cider
2 peas
3 cucumber
4 apple
5 apple rum
6 carrots
7 beans
8 carrots and apples 

我希望结果出来

    A       |      B       |     C       |    D 
1 apple        apple cider   apple rum    carrots and apples 

【问题讨论】:

    标签: excel excel-formula


    【解决方案1】:

    尝试在公式栏中输入:

    FIND(expression, text_value)
    

    也可以通过这个链接:

    http://www.smartsheet.com/help-categories/formulas
    

    【讨论】:

    • 感谢您的回复,我在发布问题之前已经尝试过,但没有奏效,或者我不明白它是如何工作的
    • 什么都没有。有帮助吗?
    【解决方案2】:

    在模块中编写这个函数:

    Public Function WordFinder(searchRange As Range, seekWord As String, iteration As Integer)
        Dim rangeCell As Range      'holder cell used in For-Each loop
        Dim rangeText As String     'holder for rangeCell's text
        Dim counter As Integer
    
        counter = 0
        'loop through cells in the range
        For Each rangeCell In searchRange.Cells
            rangeText = rangeCell.Value 'capture the current cell value
            'check if the seek word appears in the current cell
            If InStr(rangeText, seekWord) > 0 Then
                counter = counter + 1 'increment the occurrence counter
                If counter = iteration Then 'this is the occurrence we're looking for
                    'return it
                    WordFinder = rangeText
                    Exit Function
                End If
            End If
        Next rangeCell
        WordFinder = "n/a" 'that occurrence number was not found
    
    End Function
    

    在结果表的第一行,在每个单元格中输入以下公式:

    =wordfinder(Sheet2!$A1:$A8,"apple",column())
    

    column() 随每一列递增,因此当您将其复制/粘贴到顶行时,它会向上计数。美元符号确保引用绝对保留在 A 列上。

    第二个参数(“apple”)可以来自一个单元格,虽然我在这里硬编码了它。

    可能有一种更优雅的方式来做到这一点,但这是一种快速而肮脏的方式,应该可以工作。

    【讨论】:

    • 感谢您的回复我已经尝试过,但我需要更多地尝试一下
    • 你能解释一下这是什么意思吗?此外,如果它对您有用,如果您能批准该解决方案,那就太好了。谢谢。
    【解决方案3】:

    搜索使用Find()

        expression.Find(What, After, LookIn, LookAt, SearchOrder, SearchDirection, MatchCase, MatchByte, SearchFormat)
    

    例子:

         Cells.Find(What:="Cat", After:=ActiveCell, LookIn:=xlValues, LookAt:= xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
    

    【讨论】:

    • 感谢您的回复,我试过了,但没用,或者我不明白它是如何工作的
    【解决方案4】:

    我不得不手动查找值。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-12-23
      • 1970-01-01
      • 1970-01-01
      • 2016-06-15
      • 2012-10-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多