Criteria Searching

buntykins

Board Regular
Joined
Apr 11, 2002
Messages
76
Hi, I have a sheet that contains a number of words. What I want is to put a formula in that will look down the sheet and if a criteria is met, to return the column number. Can anyone help?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
On 2002-04-23 07:21, buntykins wrote:

Hi, I have a sheet that contains a number of words. What I want is to put a formula in that will look down the sheet and if a criteria is met, to return the column number. Can anyone help?

Try to be a bit more specific.
 
Upvote 0
Hi Buntykins,

I can't help but feel a little strange typing that & yuo're not my wife :wink:

Anyway - try this :

Sub Macro1()
Range("a1:a10").Select
myran = Selection.Find(What:="lewis", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Row
Range("d1").Value = myran
End Sub

This looks for "Lewis" in A1 to A10 & returns the row number in cell D1

HTH,

Iain
 
Upvote 0

Forum statistics

Threads
1,213,494
Messages
6,113,988
Members
448,538
Latest member
alex78

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