Verifying 5th character from the end of text string by searching from right to left

Pneumafire

New Member
Joined
Apr 17, 2013
Messages
4
I am using Excel 2010.

I have text strings between 30 and 40 characters in length. Let's say I have a 40-character text string in a cell, with the last 6 characters being 7 1210

What I need to do is to verify if the character between the 7 and the 1 is a space.

The formula that I need would be the equivalent of "If the fifth character from the right = " ", then do this..."

I don't want to search from the left unless I have to because there are at least 5 spaces in every string, but I am only interested in the fifth character from the end of the string. If it is a space, then I will take one action; if it is not, then I will take another.

Thanks in advance to you pros that can solve tough puzzles like this one!
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
You use a formula like this
=CODE(RIGHT(A1,5))=CODE(" ")

or (less genric)
=CODE(RIGHT(A1,5))=32
 
Upvote 0
Perfect! Well done, Mike. Thanks for the quick reply, and thanks for two solutions - they both work beautifully and accomplish exactly what I needed. Again, big KUDOS to you.
 
Upvote 0
Mike, FYI, Excel 2010 likes CODE 160 (which is also a blank space) over 32, at least with the default font Calibri.
 
Upvote 0
Here's another, bit longer tho.

=IF(--RIGHT(F1,4)=--RIGHT(F1,5),"Space","No Space")

Regards,
Howard
 
Upvote 0

Forum statistics

Threads
1,214,631
Messages
6,120,640
Members
448,974
Latest member
DumbFinanceBro

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