"and" and "or" statements between commands,

makiwara

Board Regular
Joined
Mar 8, 2018
Messages
171
Hi! I got stuck with my code, maybe I misunderstand the relations? My code:

If the word contains 1 Sylabil (column F), AND the last character is not a, e, or i AND the second last character is not a,e or i THEN result: run --> running, stop stopping and so on.

The problem is that for my words with an ending of "e" , the first line of my code shows TRUE.

But how? It have to be false!

_________________________________

If Cells(i, 6).Value = 1 And right(Cells(i, 1).Value, 1) <> "a" Or right(Cells(i, 1).Value, 1) <> "e" Or right(Cells(i, 1).Value, 1) <> "i" _
And Mid(Cells(i, 1).Value, Len(Cells(i, 1).Value) - 1, 1) <> "a" Or Mid(Cells(i, 1).Value, Len(Cells(i, 1).Value) - 1, 1) <> "e" Or Mid(Cells(i, 1).Value, Len(Cells(i, 1).Value) - 1, 1) <> "i" Then


Cells(i, 3).Value = Cells(i, 1).Value & "ing"

A column / C column / F Column

move moveing 1 (1 means the sylabil number)



So I want to get moving, deleting "e", which does my code later, but it doesnt gets to that point, because somehow the above typed code gives a TRUE OUTCOME so it gets an "ing" ending too early.

Can you help me please? I am really stucked with this one. Have a nice day!
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
You need some brackets so that the statement is interpreted correctly. I'm guessing this is what you want:

Code:
If Cells(i, 6).Value = 1 And [B][COLOR=#ff0000]([/COLOR][/B]Right(Cells(i, 1).Value, 1) <> "a" Or Right(Cells(i, 1).Value, 1) <> "e" Or Right(Cells(i, 1).Value, 1) <> "i"[B][COLOR=#ff0000])[/COLOR][/B] _
    And [B][COLOR=#ff0000]([/COLOR][/B]Mid(Cells(i, 1).Value, Len(Cells(i, 1).Value) - 1, 1) <> "a" Or Mid(Cells(i, 1).Value, Len(Cells(i, 1).Value) - 1, 1) <> "e" Or Mid(Cells(i, 1).Value, Len(Cells(i, 1).Value) - 1, 1) <> "i"[B][COLOR=#ff0000])[/COLOR][/B] Then
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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