Question about comparing 2 cell values

M

mCassidy

I have a sheet that has to columns of numbers. I would like to have a
formula that looks at the numbers in both columns (1 row at a time)
and gives me a result in column 3 based on that comparison.

Column A will be one of the following values= 0,1,2,3,4,8
Column B will be one of the following values=2,3,8

Here is my criteria for comparing the two (assuming I am comparing A1
and A2 first, with the result being in A3):

If A1=0 or 1 then A3=1 (no comparison needed on the first 3)
If A1=2 then A3=3
If A1=8 then A3=5
If A1=3 or 4 and A2=2 then A3=4
If A1=3 or 4 and A2=3 then A3=5

I can write out the specifics of what I need to compare.. I just have
no solid idea of how to put that into an Excel formula.

Any help at all is greatly appreciated.

Matt
 
P

PCLIVE

Maybe one way:

=IF(OR(A1=0,A1=1),1,IF(A1=2,3,IF(A1=8,5,IF(AND(OR(A1=3,A1=4),A2=2),4,IF(AND(OR(A1=3,A1=4),A2=3),5,"No
Match")))))

Regards,
Paul
 
G

Guest

You can us nested IF statements ("=if(expression,result if true, result if
false)"). I'm a bit confused by the criteria because it looks like the data
is in rows rather than columns (you check A1 and A2 to determine the value of
A3 rather than checking A1 and B1 To get the value of C1). if your values
are truly in columns, the expression should look something like this:

=IF(OR(A1=0,A1=1),1,IF(A1=2,3,IF(A1=8,5,IF(AND(OR(A1=3,A1=4),B1=2),4,IF(AND(OR(A1=3,A1=4),B1=3),5,"error")))))

I stuck in the word "error" for any cases that pop up where your criteria
don't cover everything. NOTE that IF statements can only be nested 7 deep.

Will
 
M

mCassidy

Thanks a ton! These posts really helped out.
....and yes.. I mis-stated how my data was arranged.. each instance
is in a row. i was thinking about it as two columns of data
though... my bad.

Thanks again :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top