IF, AND, and OR Formula #VALUE error

psuedodragon

New Member
Joined
Dec 5, 2013
Messages
22
Background: I'm working on a constructed language, and wanting to use an Excel formula to check that the rules are being followed as words are created.

So the first rule I'm trying to check is that the first letter of a word, depending on the type of word (Noun, Verb, Adjective, Adverb, and Preposition) is one of a specific set of letters.

Namely, if it's a Noun, then the first letter must be W or E
If it's a Verb, then the first letter must be a C or V
If it's an Adjective, then the first letter must be an O or U
If it's an Adverb, then the first letter must be an S or M
If it's a Preposition, then the first letter must be a Y, H, A, F, N, or T

So the formula I was trying to use was:
=IF(AND(B2="Noun",C2=OR("W","E")),"Good",IF(AND(B2="Verb",C2=OR("C","V")),"Good",IF(AND(B2="Adjective",C2=OR("O","U")),"Good",IF(AND(B2="Adverb",C2=OR("S","M")),"Good",IF(AND(B2="Preposition",C2=OR("Y","H","A","F","N","T")),"Good","Error")))))

But regardless of what values are in any of the squares, it returns a #VALUE! error.

When I click through to evaluate, its telling me the problem is with my OR function.



Suggestions or ideas?
 

Snakehips

Well-known Member
Joined
May 17, 2009
Messages
4,728
Office Version
2013
Platform
Windows
psuedodragon,

Take a look at the way you have expressed the OR statements.

Eg typically, the first one should read.... =IF(AND(B2="Noun",OR(C2="W",C2="E")),"Good",......

Hope that helps.
 

gaz_chops

Well-known Member
Joined
Apr 29, 2003
Messages
5,890
Change your OR parts to be

or(C2="W",C2="E") etc
 
Last edited:

skywriter

Well-known Member
Joined
Feb 15, 2014
Messages
1,642
It looks like your Or will work with this format also.

=IF(AND(B2="Noun",OR(C2={"W","E"})),"Good","Bad")


=IF(AND(B2="Noun",OR(C2={"W","E"})),"Good",IF(AND(B2="Verb",OR(C2={"C","V"})),"Good",IF(AND(B2="Adjective",OR(C2={"O","U"})),"Good",IF(AND(B2="Adverb",OR(C2={"S","M"})),"Good",IF(AND(B2="Preposition",OR(C2={"Y","H","A","F","N","T"})),"Good","Error")))))
 
Last edited:

Forum statistics

Threads
1,081,543
Messages
5,359,431
Members
400,526
Latest member
Brook1083

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top