Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ally1977
 
Posts: n/a
Default HELP!!! Trouble with IF, AND functions


HI the

I am trying to create a function in a spreadsheet to run a test on two
columns which computes the result for the third column, I think I need
an additional test though because when a negative number is involved I
get the wrong result.

For example:

I am trying to test column A and B. Right now my formula is =IF(B<A,
B, A). So that if column B is less than column A my result is the
total in column B but if Column B is greater than column A my answer is
the total in column A. However, if the answer is going to be a negative
I want column C to say 0 not a negative number.

Column A Column B Column C
100 50 s/b 50
25 100 s/b 25
-100 10 s/b 0

At this point if my answer is negative using the above function, the
negative number is put in columm C. I want it to be 0. Can anyone
tell me how I can do this. I have tried using an "AND" function to do
this but then my answer always winds up being 0.

Your help is greatly appreciated.


--
Ally1977
------------------------------------------------------------------------
Ally1977's Profile: http://www.excelforum.com/member.php...o&userid=31483
View this thread: http://www.excelforum.com/showthread...hreadid=511605

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
via135
 
Posts: n/a
Default HELP!!! Trouble with IF, AND functions


hi

try this one!

=IF(AND(B1<A1,A10),B1,IF(A1<0,0,A1))

-via135



Ally1977 Wrote:
HI the

I am trying to create a function in a spreadsheet to run a test on two
columns which computes the result for the third column, I think I need
an additional test though because when a negative number is involved I
get the wrong result.

For example:

I am trying to test column A and B. Right now my formula is =IF(B<A,
B, A). So that if column B is less than column A my result is the
total in column B but if Column B is greater than column A my answer is
the total in column A. However, if the answer is going to be a negative
I want column C to say 0 not a negative number.

Column A Column B Column C
100 50 s/b 50
25 100 s/b 25
-100 10 s/b 0

At this point if my answer is negative using the above function, the
negative number is put in columm C. I want it to be 0. Can anyone
tell me how I can do this. I have tried using an "AND" function to do
this but then my answer always winds up being 0.

Your help is greatly appreciated.



--
via135
------------------------------------------------------------------------
via135's Profile: http://www.excelforum.com/member.php...o&userid=26725
View this thread: http://www.excelforum.com/showthread...hreadid=511605

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ally1977
 
Posts: n/a
Default HELP!!! Trouble with IF, AND functions


THANK YOU SO MUCH!!!

I have had a headache all night trying to do this. Your suggestion
worked perfectly. Thank you.


--
Ally1977
------------------------------------------------------------------------
Ally1977's Profile: http://www.excelforum.com/member.php...o&userid=31483
View this thread: http://www.excelforum.com/showthread...hreadid=511605

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Arvi Laanemets
 
Posts: n/a
Default HELP!!! Trouble with IF, AND functions

Hi

=MAX(0,MIN(A1,B1))


--
Arvi Laanemets
( My real mail address: arvi.laanemets<attarkon.ee )


"Ally1977" wrote in
message ...

HI the

I am trying to create a function in a spreadsheet to run a test on two
columns which computes the result for the third column, I think I need
an additional test though because when a negative number is involved I
get the wrong result.

For example:

I am trying to test column A and B. Right now my formula is =IF(B<A,
B, A). So that if column B is less than column A my result is the
total in column B but if Column B is greater than column A my answer is
the total in column A. However, if the answer is going to be a negative
I want column C to say 0 not a negative number.

Column A Column B Column C
100 50 s/b 50
25 100 s/b 25
-100 10 s/b 0

At this point if my answer is negative using the above function, the
negative number is put in columm C. I want it to be 0. Can anyone
tell me how I can do this. I have tried using an "AND" function to do
this but then my answer always winds up being 0.

Your help is greatly appreciated.


--
Ally1977
------------------------------------------------------------------------
Ally1977's Profile:
http://www.excelforum.com/member.php...o&userid=31483
View this thread: http://www.excelforum.com/showthread...hreadid=511605



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default HELP!!! Trouble with IF, AND functions

via135" wrote:
=IF(AND(B1<A1,A10),B1,IF(A1<0,0,A1))


"Ally1977" wrote apparently in response:
Your suggestion worked perfectly.


I am surprised to hear you say that. In "via135's" solution,
if B is negative and A is positive, the result will be negative
-- B.

But you wrote: "if the answer is going to be a negative I
want column C to say 0 not a negative number". I assume
that should be true even if B is negative, although you only
have an example with A negative.

Perhaps you never expect B<0. But the solution offered by
"arvi" still seems to be the best one, just in case, namely:

=max(0, min(a1,b1))

That is, choose the smaller of A or B, but choose 0 if the
smaller is negative. If you prefer an IF() function, then:

=if(or(A1<0,B1<0), 0, if(A1<B1, A1, B1))


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I get Excel to determine the line curve formula without graph. Cadelima Excel Discussion (Misc queries) 8 December 20th 05 09:57 PM
User-defined functions created in Excel 2000 fail in Excel 2003 goodguy Excel Discussion (Misc queries) 1 October 3rd 05 07:04 PM
Database functions should use criteria in formula, as 1-2-3 does 123user Excel Worksheet Functions 8 September 29th 05 08:57 PM
Changing the range of several averaging functions Hellion Excel Discussion (Misc queries) 1 September 17th 05 02:12 PM
Visible rows and functions that work tracy Excel Worksheet Functions 2 August 19th 05 05:25 AM


All times are GMT +1. The time now is 02:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"