列Dは、Eが内容を交換する値を含む列A列の検索フィールドのどこにでも可能性を探すためのサブストリングを含み、列Aは。列Bの結果を参照してください。
After implementing suggested solution
列Dは、Eが内容を交換する値を含む列A列の検索フィールドのどこにでも可能性を探すためのサブストリングを含み、列Aは。列Bの結果を参照してください。
After implementing suggested solution
私はこれを解決するVBスクリプト作成しました:
Sub DetermineFeatures()
Dim featureLabel As String
Dim testString As String
testString = "FEAT_EMV_L4, Team_1, Team_IBM"
Dim stringValue As Variant
Dim lookupRange As Range
Set lookupRange = Worksheets("LookupTable").Range("A1:B100")
Dim outputWorksheet As Worksheet
Set outputWorksheet = Worksheets("Output")
Dim feature As String
Dim rowIndex As Long
For Each cell In Worksheets("Original").Columns("O").Cells
rowIndex = cell.Row
cellValue = WorksheetFunction.Trim(cell.Value)
For Each stringValue In Split(cellValue, ",")
If InStr(stringValue, "LABEL_") Then
featureLabel = Trim(stringValue)
' Call the Vlookup function to look up the actual feature name
for the supplied label. This
' returns the value from the second column of the range within
the LookupTable worksheet.
feature = Application.WorksheetFunction.VLookup(featureLabel,
lookupRange, 2, False)
outputWorksheet.Cells(rowIndex, 1) = feature
If Not IsEmpty(featureLabel) Then Exit For
End If
Next
Next cell
End Sub
これは機能しますが、それほどエレガントではなく、容易に拡大/縮小できません。
=CONCATENATE(REPT($E$1,COUNTIF(A1,"*"&$D$1&"*")),REPT($E$2,COUNTIF(A1,"*"&$D$2&"*")),REPT($E$3,COUNTIF(A1,"*"&$D$3&"*")))
それはREPT(Replacement,COUNTIF(Values,*Labels*))
のシリーズです。検索の前後にある*
はワイルドカードにすることができます。要素が含まれているかどうかをCOUNTIFのフラグに設定します。次に、置換値をcountifが存在する回数(この例では常に1です)と繰り返して、結果を連結します。
こんにちは@のgowtham-シヴァを、私はあなたの式は、仕事を得るように見えることはできません。 Excelはそれが有効ではないと言います。しかしこれは素晴らしい解決策のようです。数式をもう一度見てもらえますか? – Antenne
@Antenneそれは私のためにうまく動作します。カンマをセミコロンに変更して、数式で1回試すことはできますか –