Nested OR in an IF statement, possibly parenthesis issue?

opal1989

New Member
Joined
Feb 27, 2016
Messages
3
Hi all, thank you for reading.

I am working with a large date set and I need to identify all of the cells in a certain row that start with a vowel. I have created a new column next to the column in question and entered this statement:

IF(Left(A1,1) = OR("a","e","i","o","u"), "vowel", " ")

This returns #VALUE...I don't know if it's an issue with my parenthesis or my placement of the OR statement.

Conversely, when I enter this formula it works:
IF(OR(Left(A1,1) = "a", (Left(A1,1) = "e"), (Left(A1,1) = "i"), (Left(A1,1) = "o"), (Left(A1,1) = "u")), "vowel", " ")

This is so long and inefficient, thought it works. I noticed I didn't close the parenthesis after the "a", though when I did add one it no longer worked and read: Too many formulas.

I really want to present a more efficient formula. Alternatively I could apply a macro in VBA, though I don't know how that works.

Any suggestions are appreciated.


 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Works! Thank you so much Weazel! I haven't seen {} used before, are you creating an Array or is that just a way to distinguish different statements?
 
Upvote 0
Works! Thank you so much Weazel! I haven't seen {} used before, are you creating an Array or is that just a way to distinguish different statements?
 
Upvote 0
essentially you're creating an array of values that the OR will test against the value returned by the left.
since these values are fixed, you can create an array constant instead of repeating the whole logical test
I forget all the details as to how the OR handles multiple values compared to the AND which cannot.
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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