A1:A10
在列A中搜索值。
输出应为:
对于多个值:
修改
我不得不用德语替换这些功能,但它对我不起作用。
=GLÄTTEN(VERKETTEN(D2;" ";E2;" ";F2;" ";G2))
对于C2,我添加了:=GLÄTTEN(VERKETTEN(B2;" ";D2;" ";E2;" ";F2;" ";G2))
对于C10,我添加了:=GLÄTTEN(LINKS(B10;FINDEN(" ";B10)))
=GLÄTTEN(LINKS(B11;FINDEN(" ";B11)))
=GLÄTTEN(LINKS(B12;FINDEN(" ";B12)))
对于F10,我添加了:=GLÄTTEN(B13)
对于B11,我添加了:=TEIL(B10;LÄNGE(C10)+2;99)
=TEIL(B11;LÄNGE(D10)+2;99)
=TEIL(B12;LÄNGE(E10)+2;99)
我从here获得的翻译。
答案 0 :(得分:1)
我用VBA代码解决了你的问题。要使用它,请在Excel工作簿中创建一个VBA模块并粘贴以下代码。然后返回到要运行它的工作表,并单击“宏”并选择“搜索”。
让我知道它是如何工作的〜
示例:强>
代码:
Public Sub search()
'Enter the location of your "Key Word" cell here (where you want the search values to come from)
Dim KeyCell As String: KeyCell = "B11"
'Enter the range you would like to search here
Dim searchRange As Range: Set searchRange = ActiveSheet.Range("A2", "A11")
'Enter the column you want to print to
Dim printColumn As String: printColumn = "B"
'##### the real program starts here ####
'create an array of values that we will search for
Dim values() As String
'each item in the values array is separated by a space in the "Key Word" cell
values = Split(CStr(ActiveSheet.Range(KeyCell).Value), " ")
Dim dataCell As Object
'now we loop through each cell in the search range
For Each dataCell In searchRange
'loop through each value in our array of values
For Each v In values
'check to see if our value is in the cell we are searching
If InStr(1, CStr(dataCell.Value), CStr(v), vbBinaryCompare) > 0 Then
'print
With ActiveSheet.Range(printColumn & dataCell.Row)
.Value = .Value & " " & CStr(v)
End With
End If
Next v
Next dataCell
End Sub
答案 1 :(得分:1)
您可以在VBA中高效地执行此操作
...Tools-Macro-Macros
enter code here
Sub QuickFInd()
Dim X As Variant
Dim Y As Variant
Dim vWords As Variant
Dim Vword As Variant
Dim lngCnt As Long
X = Range("A2:A8").Value2
ReDim Y(1 To UBound(X), 1 To 1)
vWords = Split([b10].Value)
For lngCnt = 1 To UBound(X)
For Each Vword In vWords
If InStr(X(lngCnt, 1), Vword) > 0 Then Y(lngCnt, 1) = Y(lngCnt, 1) & Vword & Chr(32)
Next Vword
Next
[b2].Resize(UBound(Y), 1).Value2 = Y
End Sub
答案 2 :(得分:0)
如果您只想进行没有PASTE或VBA的搜索,可以按照以下方案进行:
并添加公式:
B2 -> =TRIM(CONCATENATE(D2;" ";E2;" ";F2;" ";G2))
C2 -> =IF(IFERROR(FIND(C$10;$A2)>0;"")=TRUE;C$10;"") and autocomplete
C10 -> =TRIM(LEFT(B10;IFERROR(FIND(" ";B10);99))) CORRECT !
D10 -> =TRIM(LEFT(B11;IFERROR(FIND(" ";B11);99))) CORRECT !
E10 -> =TRIM(LEFT(B12;IFERROR(FIND(" ";B12);99))) CORRECT !
F10 -> =TRIM(B13)
B11 -> =MID(B10;LEN(C10)+2;99)
B12 -> =MID(B11;LEN(D10)+2;99)
B13 -> =MID(B12;LEN(E10)+2;99)
隐藏支持公式列。你可以添加你想要多少个单词...显然添加其他公式。
如果您需要在数值上添加值,可以在A&之间添加一列。 B并复制并粘贴已移动的列" C" (前B)。修改C2公式:
=TRIM(CONCATENATE(B2;" ";D2;" ";E2;" ";F2;" ";G2)) and autocomplete...
此公式添加已保存的密钥...(无重复检查) 我有正确的公式...以前只用4键...
答案 3 :(得分:0)
你可以这样做:
=IF(IFERROR(FIND($B$10,A2,1),0)>0,$B$10&" ","")&IF(IFERROR(FIND($B$11,A2,1),0)>0,$B$11&" ","")&IF(IFERROR(FIND($B$12,A2,1),0)>0,$B$12&" ","")
只需自动填充所有文字项目。