IF OR with ISTEXT

Chialiwa

New Member
Joined
Feb 15, 2018
Messages
27
I'm trying to write a formula that says if the 8th character in my string (from the left) is either the number 1 or a letter, then return the left 8 characters, if not, return the left 7. However, when I use this it always returns 8 characters no matter what. What am I doing wrong? (I'm entering this formula in cell A1):

=IF(OR(LEFT(B1,8)=1,ISTEXT(LEFT(B1,8))),LEFT(B1,8),LEFT(B1,7))

Thank you!
 
One other thing.
MID and LEFT are string functions, so return strings.
So I think it would need to look like this:
MID(B1,8,1)="1"
(quotes needed)
 
Upvote 0

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Chialiwa,

I missed the -- sign at original formula.

Try to use:

=IF(OR(--MID(B1,8,1)=1,MID(B1,8,1)>=CHAR(65)),LEFT(B1,8),LEFT(B1,7))
I hope it helps
 
Upvote 0
THanks, Marcilio! It didn't work when I put the -- before mid, but works if I put it before the --OR. THank you!!!!!

Chialiwa,

I missed the -- sign at original formula.

Try to use:

=IF(OR(--MID(B1,8,1)=1,MID(B1,8,1)>=CHAR(65)),LEFT(B1,8),LEFT(B1,7))
I hope it helps
 
Upvote 0

Forum statistics

Threads
1,213,530
Messages
6,114,162
Members
448,554
Latest member
Gleisner2

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