Looking for a Specific Character in a Specific Location in a String

Philip1957

Board Regular
Joined
Sep 30, 2014
Messages
185
Office Version
  1. 365
Platform
  1. Windows
Greetings,

I know how to use INSTR to see if a string contains a specific character, and I know how to use INSTR to return the index number of a character in a string.

How do I search a string for a specific character at a known index number? In other words, tell me if there is a 5 at index #3 .

It seems that this should be relatively easy but . . .

Thanks in advance for any assistance.

~ Phil
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
If I understand your question correctly, generally like this...

If InStr("YourText", 5, 1) = SpecificCharacter Then
 
Upvote 0
Thank you very much! I'll use this later this afternoon when I can get back to my VBA project.

I was close in my attempts. It's always the syntax that causes me problems.

Thank you again for your time.

~ Phil
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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