Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel - 'Find' function doesn't work properly 1

Status
Not open for further replies.

pho01

Programmer
Joined
Mar 17, 2003
Messages
218
Location
US
'Find' worksheet function doesn't work properly. Here's what I've tested:
Column C row 3 has the string:
[Next Action] [This is a test]

worksheet formulas:
=FIND("[",C3,1) => 1 yes
=FIND("[",C3,2) => 15 yes
=FIND("]",C3,1) =>13 yes
=FIND("]",C3,2) =>13 wrong

was that something i didn't do right to come up with a wrong value or is that Excel defect?
Thanks!
 
=FIND("]",C3,2) =>13
You get this because you put the start position for the find at position 2
There is a ] at pos 13 so whether you start at 1 or 2 doesn't matter....to find the last one of "]" you need to start at pos 14 ie AFTER the 1st one so
=FIND("]",C3,14)
will return the correct position. To get round this, you can use:
=FIND("]",C3,FIND("]",C3)+1)

Rgds
Geoff
Si hoc legere scis, nimis eruditionis habes
Get the best answers to your questions - faq222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top