Best way to find a partial string in a row of data ?

Sparkle99

Board Regular
Joined
May 22, 2009
Messages
119
I need to find a partial string in row 1 of a sheet
e.g. find "Item.Value" where E1 is "Item.Value01", F1 is "Item.Value02" etc..

I need to return 'E' or number 5 to indicate the column.

I've written a function that uses Application.WorksheetFunction.Find - but this doesn't seem to work.

Code...
findval = Application.WorksheetFunction.Find(MatchVal, "'Item#'!A1")

Where I have a loop to substitute the cell value, the sheet is called Item# and the value is contained in the string MatchVal.
Anyone spot my mistake ? There must be one !

Cheers for your help.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
To get the 1st occurence ONLY use:
Excel Workbook
ABCDEFGHIJK
1ktq-hddabcnnnrnmItem.Value01Item.Value02Find FirstFound In
2occurrence ofColumn #
3Item.Value5
Sheet1
Excel 2007
Cell Formulas
RangeFormula
K3=MATCH("Item.Value*",A1:F1,0)
 
Upvote 0
Modified.... to

=MATCH(J3,A1:F1,0)
where J3 is:
Item.Value*, or Item.Value01, or Item.Value02
 
Upvote 0
Thanks Jim, just after I submitted my question I realised this would work.

But, how would I find the last cell that also matches the string ?
 
Upvote 0
This might be a better way;
Excel Workbook
ABCDEFGHIJK
1ktq-hddabcnnnrnmItem.Value01Item.Value02Find FirstFound In
2occurrence ofColumn #
3Item.Value015
4
5Item.Value026
Sheet1
Excel 2007
Cell Formulas
RangeFormula
K3=LOOKUP(2,1/(A$1:F$1=J3),COLUMN(A$1:F$1))
K5=LOOKUP(2,1/(A$1:F$1=J5),COLUMN(A$1:F$1))
 
Upvote 0

Forum statistics

Threads
1,214,787
Messages
6,121,565
Members
449,038
Latest member
Guest1337

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top