if(and...problem

bluepenink

Well-known Member
Joined
Dec 21, 2010
Messages
585
hello

having a problem with the if(and formula, can someone pls help me with the logic!

=IF((D53=$E$53),"-",IF(AND(D53=$E$53,D46>D53),D53-D46,D46-D53))

it works fine, however, when

D53 > D46, i want it to D53-D46

the current formula that i have, is making the answer negative. the formula above works fine when D53 <D46, but when D53 > D46, it makes the value negative....can someone pls help!

thx u so much

basically, i want the formula to be as is, but when
D53 > D46, i want it to D53-D46
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Maybe something like

=IF((D53=$E$53),"-",IF(AND(D53=$E$53,D46>D53),D46-D53,MAX(D46,D53)-MIN(D46,D53))

HTH

M.
 
Last edited:
Upvote 0
hello

having a problem with the if(and formula, can someone pls help me with the logic!

=IF((D53=$E$53),"-",IF(AND(D53=$E$53,D46>D53),D53-D46,D46-D53))

it works fine, however, when

D53 > D46, i want it to D53-D46

the current formula that i have, is making the answer negative. the formula above works fine when D53 <D46, D53 when but>D46, it makes the value negative....can someone pls help!

thx u so much

basically, i want the formula to be as is, but when
D53 > D46, i want it to D53-D46

Maybe something like

=IF((D53=$E$53),"-",IF(AND(D53=$E$53,D46>D53),D46-D53,MAX(D46,D53)-MIN(D46,D53))

HTH

M.

Marcelo,

The OP's AND bit can never evaluate to TRUE...

It appears that the following expresses the same thing:

=IF(D53=$E$53,"-",ABS(D53-D46))

Or with more caution...

=IF(COUNT(D53:E53)=2,IF(D53=$E$53,"-",ABS(D53-D46)),"")
 
Upvote 0
Marcelo,

The OP's AND bit can never evaluate to TRUE...

It appears that the following expresses the same thing:

=IF(D53=$E$53,"-",ABS(D53-D46))

Or with more caution...

=IF(COUNT(D53:E53)=2,IF(D53=$E$53,"-",ABS(D53-D46)),"")

Oh.. you are right!

I didnt notice that there was the same condition

D3=$E$53

outside the AND (as the first IF condition)

As the OP said the formula was working ok... i overlooked this.

That said:

jw01,

think about what your original formula is doing, and try to tell us what you are trying to do.

M.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,280
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top