English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I want to create an IF/THEN formula where I have four columns, the first one has either a Y or a N. The next two have dollar values and if there is a Y in the first column, I want the fourth column to display the difference between the two. (3rd - 2nd). If there is a N in the first column, I want the fourth column to display either a 0 or nothing. Everything I try to put in says error can anyone help?

here is what I have that it's not accepting: =IF(G2=Y),[H2-E2],[0]

Using Excel 2002

2007-01-18 03:53:25 · 3 answers · asked by elsengland 1 in Computers & Internet Software

I got it to work thanks for your help!

2007-01-18 05:25:55 · update #1

3 answers

If you want zero to be the value (so you can format for accounting:
=IF(G2="Y",H2-E2,0)

If you actually want to see the 0 in that last column:
=IF(G2="Y",H2-E2,"0")

The other two answers won't work, as the Y is a string value and therefore you MUST enclose the Y in " ".

2007-01-18 04:04:39 · answer #1 · answered by wyntre_2000 5 · 0 0

The formula you have given is:
IF(G2=Y),[H2-E2],[0]

The correct formula is:
If(G2=Y,H2-E2,0)

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Examples:
For trying to analyze data from a survey completed earlier & wanted to use a statement that allowed him to test for two different things at once. He was using the following:

=IF(L78=AA$1,1,0)

to determine if an item in column L is the same as the header he’d created in column AA.

He would like to create a similar IF statement that allows him to compare items in two separate columns, and if the condition is true, put the contents of a third column in the cell.


Epidemic offered a Nested IF statement as follows

=IF(A1=A2,IF(A2>A3 ,"yep", "nope"),"never")

Basically you can stack the If's in their appropriate then or else position.

=IF(something=1, Then, Else)

You simply stack your next if in place of the (then or the else) Be careful with your close brackets.


bnix pointed out that you can also use the OR/AND operator in your formula

=IF(AND(A1="blue",B1="red"),"MyColor","NoColor")


=IF(OR(A1="blue",B1="red"),"MyColor,"NoColor")
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I hope this helps you.

Regards,
Praveen Kumar

2007-01-18 12:01:05 · answer #2 · answered by P Praveen Kumar 5 · 0 1

=IF(G2="Y",H2-E2,0) is the correct syntax

I re-edited to add the ""..thx to the person who answered after me :)

2007-01-18 12:03:44 · answer #3 · answered by Robert M 2 · 1 0

fedest.com, questions and answers