Forum Discussion
Keywords in one column to populate another
Golfnhockey12: can you clarify a bit? Where do you enter your search parameters? It's not clear what you want from your description when looking at your sample file. Please be as detailed as possible when describing what you want to do from what you have.
I have a column called Vendor which is Column D, some are blank some say Scientific Solutions. I want a formula, that looks at all the text in column C which is the description, and if it finds the word sharptec, then in column d it auto populates the Vendor Sharptec replacing the blank or Scientific Solutions
- Zack BarresseApr 30, 2020Iron ContributorTrue. My solution was created around my understanding of the OP's requirements. As far as I'm aware, it is a suitable solution. Haven't really heard back if it is or not though.
- Khizar_HayatApr 30, 2020Brass Contributorwhen we have a complete knowledge about a problem , than it can be solved otherwise it will remain a problem.
- Zack BarresseApr 29, 2020Iron ContributorI'm not sure I follow. My understanding of the requirements were the OP has a list of keywords to search for (in column C) and - if found, replace the value in the Vendor field (column D) with said value, otherwise return what was already in that field.
- Khizar_HayatApr 29, 2020Brass Contributor
Zack Barresse so where we can get a vendor name?
already in column D there is a vendor name present as next to the "sharpertek" so what is the criteria?
- Golfnhockey12Apr 29, 2020Copper Contributor
Vendors are in column D. So instead of the word included it puts the vendors name.
- Zack BarresseApr 29, 2020Iron ContributorKhizar_Hayat: Isn't the Vendor name in column D?
Golfnhockey12: did you try the VBA solution I posted above? - Khizar_HayatApr 29, 2020Brass ContributorHurry up i am waiting your response
- Khizar_HayatApr 29, 2020Brass Contributor
Where is the vendor name?
- Khizar_HayatApr 29, 2020Brass Contributorok i am doing this, wait a minute friend
- Golfnhockey12Apr 29, 2020Copper Contributor
And what you did worked, but instead of saying included I wanted the name of the vendor.
- Khizar_HayatApr 29, 2020Brass Contributor
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?
- Zack BarresseApr 29, 2020Iron Contributor
Wyn Hopkins that's a very clever method!
- Wyn HopkinsApr 28, 2020MVP
This video shows how to do this type of thing using Excel's Power Query
- Golfnhockey12Apr 28, 2020Copper Contributor
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.
- Khizar_HayatApr 28, 2020Brass Contributori have tried to solve your problem and write a formula as well
it working great,
i am waiting your good response my friend - Khizar_HayatApr 28, 2020Brass Contributor
we got a solution my friend, check it and tell me Golfnhockey12
- Khizar_HayatApr 28, 2020Brass Contributor
my friend i am sending you a solution in msg and then check and tell me must you got your solution or not Golfnhockey12
- Zack BarresseApr 28, 2020Iron Contributor
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 SubHTH
- Golfnhockey12Apr 28, 2020Copper Contributor
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.
- Zack BarresseApr 28, 2020Iron ContributorWe 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. - Golfnhockey12Apr 28, 2020Copper Contributor
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.
- Zack BarresseApr 28, 2020Iron ContributorCan 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?
- Golfnhockey12Apr 28, 2020Copper Contributor
Did not work, it returned the same value in colunm D.
- Golfnhockey12Apr 28, 2020Copper Contributor
Does not work, I get an error. Can you add it to my file I attached and see if you get it?
- Golfnhockey12Apr 28, 2020Copper ContributorCorrect, right now I have three, which each one corresponds to a vendor.