Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

First I'm no Excel formula guru..

I want to write a formula that is comparing 4 possible string values

such as: Up, Down, Left, Right

pseudocode would be say:

if a1="Up" and a2="Down" then 1.1
else if a1="Left" and a2="Right" then 1.1
else if a1="Left" and a2="Down" then .95
else if a1 = a2 then 1

I'd cover all the permutations..

answer: =IF(R25=R26,1,IF(AND(R25="Up",R26="Down"),1.1,IF(AND(R25="Down",R26="Up"),1.1,IF(AND(R25="Left",R26="Right"),1.1,IF(AND(R25="Right",R26="Left"),1.1,0.95))))) – DJPlayer Oct 3, 2014 at 13:35

=IF(1=2,do this,if(1=3,do this,if(1=4,do this,if(2=3,do this,if(2=4,do this,if(3=4,do this,value if every test fails))))))

I THINK Excel has a limit of 7 nested if formulas or perhaps even formulas in general.

gone it thanks.. I thought I'd have to go through all permutations but I saw that value if everything fails.. since after 5 conditions I know what the result must be I didn't max out. – DJPlayer Oct 3, 2014 at 13:35 don't think so.. or maybe I'm not coding test correctly. Test needs to be a test on two conditions.. ie. a1="up" & a2="down". – DJPlayer Oct 3, 2014 at 13:12

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.