bex77: (Default)
[personal profile] bex77
Do you know Excel? I need help!

I need an Excel formula. I can make it work on paper, but Excel won't take it. It may be something simple, like a missing comma or paren, or I might be totally off. I used to be an ace, but my Excel foo has been rusting for awhile.

Here's the scoop.

I have two columns of data (A and B).

If they are the same, I want C to zero.
If A is higher, I want a 1.
If B is higher, I want a 2.

What formula do I put in C?

A B C
4 2 1
4 4 0
4 6 2

Here is what I tried:
=IF(A-B=0,0,=IF(A>B,1,2))
OR
=IF(A-B=0,0,(=IF(A>B,1,2)))

Excel doesn't like either one. I even tried the "function entering" wizard, to no avail.

Then I tried making two columns, trying to get the two clauses then compare them in a third. Didn't get very far on that front.

If anyone has a clue, I'd appreciate it.

Thanks!

Date: 2007-07-18 07:41 pm (UTC)
From: [identity profile] wellstar.livejournal.com
In column C1, type:

=IF(A1>B1,1)+IF(A1=B1,0)+IF(A1<B1,2) You can then drag-extend it down so it applies to the rest of the C column: the A1 & B1 would turn into A2 & B2 in the formula in C2, A3 & B3 in C3, etc.

Date: 2007-07-18 07:45 pm (UTC)
From: [identity profile] trowa-barton.livejournal.com
What she said with regards to drag-extending the formula. However, there is no "+" for the second and third IF statements, hence:

=IF(A1-B1=0,0,IF(A1>B1,1,2))

Date: 2007-07-18 07:45 pm (UTC)
From: [identity profile] wellstar.livejournal.com
Okay, something weird is going on with the line break. The instructions to drag-extend it (I don't know the actual term...it's where you click the lower left corner of the cell and pull it down to the next row) should be on a separate line than the formula. Obviously, all you need to type in C1 is the equation with the three addends.

Date: 2007-07-18 07:47 pm (UTC)
From: [identity profile] wellstar.livejournal.com
It does work with the "+" sign, but yeah, that's more elegant. I forgot about the true-false double-comma.

Profile

bex77: (Default)
bex77

November 2024

S M T W T F S
     12
3456789
10111213141516
17181920212223
242526 27282930

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 13th, 2026 09:01 pm
Powered by Dreamwidth Studios