Keywords in one column to populate another

Copper Contributor
I have a file we’re in one column is have a description, I want to make a formula to look at that column for keywords which populates another column from a key.
48 Replies

=IF(ISNUMBER(SEARCH(OR("Sharpertek","BVV","Across" C2)),"populated",Blank)

@Golfnhockey12 

it will be work according to your condition my friend
waiting for your positive reply

@Golfnhockey12 

 

Just to clarify

 

You'd like to identify certain key words (products) from column C and then populate column D with the corresponding vendor?  Is that right?

 

If so how many different Key words do you need to look for?

 

Thanks

 

Wyn

 

Correct, right now I have three, which each one corresponds to a vendor.

@Khizar_Hayat 

 

Does not work, I get an error. Can you add it to my file I attached and see if you get it?

@Zack Barresse 

Did not work, it returned the same value in colunm D.

Can you identify where this criteria range of values is? Is it on a sheet right now? Also, are you looking for a formula or VBA solution? What version of Excel are you running?

@Zack Barresse 

 

I have office 365, in the attached you will see Sheet 5 with a key I want to use. in the keyword column, these are searched within all of column C, and if they match it returns a value in Column D corresponding to the values under the Vendor column.

We need to be a little more specific here. Are you wanting to replace the values in column D of your data sheet with this logic? Should an additional column be created instead of overwriting data? Should the search be case-sensitive?

In terms of a solution, were you wanting a formula solution (e.g. add another column in which to return results) or a VBA solution? Is this going to be done repetitively? I notice this is a CSV file and it looks like it's from a web query from shopify. Is the master data somewhere else? Do you query to return it? If so, what is the URL or data source you're using? There may be a solution with Power Query we could use also.

To be clear, we need more information to give you a solution. Please be as thorough and specific as possible. It would help if you could answer all of the questions and expound on any you feel contain additional relevant information.

@Zack Barresse 

 

We need to be a little more specific here. Are you wanting to replace the values in column D of your data sheet with this logic? Should an additional column be created instead of overwriting data? Should the search be case-sensitive? - NO Additional column, I want to override that data, does not need to be case sensitive. I want to Search Column C based on my table, and replace the values in Column D that correspond to my table given. 

 

In terms of a solution, were you wanting a formula solution (e.g. add another column in which to return results) or a VBA solution? Which ever is easier, I am new to excel. Is this going to be done repetitively? I notice this is a CSV file and it looks like it's from a web query from shopify. Is the master data somewhere else? You have an export I just did from Shopify, once I do it once I will update manually, I am just trying to do a mass update right now.  Do you query to return it? If so, what is the URL or data source you're using? There may be a solution with Power Query we could use also. No return, can not give an URL.

@Golfnhockey12 in that case I'd opt for a VBA solution. The below code will do what you want. Install it in the workbook you want it run in.

 

Sub ReplaceVendors()
    
    Dim SourceSheet As Worksheet
    Dim CriteriaSheet As Worksheet
    Dim DataRange As Range
    Dim RowIndex As Long
    Dim CriteriaIndex As Long
    Dim Criteria As Variant
    Dim Source As Variant
    Dim Values As Variant
    
    Set SourceSheet = ThisWorkbook.Worksheets("shopexcel")
    Set CriteriaSheet = ThisWorkbook.Worksheets("Criteria")
    With SourceSheet
        Set DataRange = .Range("A2", .Cells(.Cells(.Rows.Count, 1).End(xlUp).Row, .Cells(1, .Columns.Count).End(xlToLeft).Column))
        Source = DataRange.Value
    End With
    With CriteriaSheet
        Criteria = .Range("A2", .Cells(.Cells(.Rows.Count, 1).End(xlUp).Row, .Cells(1, .Columns.Count).End(xlToLeft).Column))
    End With
    ReDim Values(1 To UBound(Source, 1), 1 To 1)
    
    For RowIndex = LBound(Source, 1) To UBound(Source, 1)
        Values(RowIndex, 1) = Source(RowIndex, 4)
        For CriteriaIndex = LBound(Criteria, 1) To UBound(Criteria, 1)
            If InStr(1, LCase(Source(RowIndex, 3)), LCase(Criteria(CriteriaIndex, 1)), vbTextCompare) > 0 Then
                Values(RowIndex, 1) = Criteria(CriteriaIndex, 2)
                Exit For
            End If
        Next CriteriaIndex
    Next RowIndex
    
    SourceSheet.Range("D2:D" & DataRange.Rows.Count).Value = Values
    
End Sub

 

HTH

my friend i am sending you a solution in msg and then check and tell me must you got your solution or not @Golfnhockey12 

we got a solution my friend, check it and tell me  @Golfnhockey12 

i have tried to solve your problem and write a formula as well
it working great,
i am waiting your good response my friend

@Khizar_Hayat 

I see what it did, but look at line 977, it has Sharpertek in Column C, but on your search column is has the word included.

@Golfnhockey12 

 

This video shows how to do this type of thing using Excel's Power Query

https://youtu.be/yXxHqD2p6JE

 

 

 

@Wyn Hopkins that's a very clever method!

@Golfnhockey12  sharpertek, Across and Bvv is your critertia that's why your criteria word will be find in column C show as included its your target.

but right now what is your criteria? 

can you tell me clearly?

@Khizar_Hayat 

And what you did worked, but instead of saying included I wanted the name of the vendor.