• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Need help with a quick If/Then problem

oogachaka

New Member
Apologies if this is already on here, but my searches came up empty with regards to what I need here. This should be pretty basic, I'm just hitting a wall. The straight forward example of what I need is to run a formula in cell B1 that references the content in A1 and based on a criteria plugs a designated character into cell C1. So, for example, if A1 contains "SA", then C1 is populated with a "1". If it is "PR" then C1 is populated with a "0", and so on.
 
The formula wouldn't be in B1, it would be in C1.

If SA and PR are your only choices, this formula will work:

=IF(A1="SA",1,0)


If you've got more choice you could nest IF functions:

=IF(A1="SA",1,IF(A1="PR",0,"Something else")


But if you've got multiple entries with (different) corresponding values, I'd recommend using a table somewhere and then a lookup formula like:

=VLOOKUP(A1,MyTable,2,FALSE)
 
Back
Top