ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   if 200 and <300 formula (https://www.excelbanter.com/excel-worksheet-functions/147916-if-200-300-formula.html)

ann

if 200 and <300 formula
 
how do i do a if A1 200 and <300 return A1 otherwise return 0. i can't get
the logic to work

Trevor Shuttleworth

if 200 and <300 formula
 
=IF(AND(A1200,A1<300),A1,0)

Regards

Trevor


"Ann" wrote in message
...
how do i do a if A1 200 and <300 return A1 otherwise return 0. i can't
get
the logic to work




[email protected]

if 200 and <300 formula
 
Ann

=if(and(A1200,A1<300),A1,0)

is one way.

Good luck.

Ken
Norfolk, Va


On Jun 25, 4:18 pm, Ann wrote:
how do i do a if A1 200 and <300 return A1 otherwise return 0. i can't get
the logic to work




Piscator

if 200 and <300 formula
 
One way is with two IF statements. logically reads:
If (A1200 then If A1<300 then A1, else 0), else 0)

=IF(A1200,IF(A1<300,A1,0),0)


Rick Rothstein \(MVP - VB\)

if 200 and <300 formula
 
how do i do a if A1 200 and <300 return A1 otherwise
return 0. i can't get the logic to work


Everyone has given you the IF function method, so let me be different.<g

=A1*AND(A1200,A1<300)

Rick

ann

if 200 and <300 formula
 
thanks all, the first was the easiest and it works!

"Rick Rothstein (MVP - VB)" wrote:

how do i do a if A1 200 and <300 return A1 otherwise
return 0. i can't get the logic to work


Everyone has given you the IF function method, so let me be different.<g

=A1*AND(A1200,A1<300)

Rick


Roger Govier

if 200 and <300 formula
 
Or even

=A1*(A1200)*(A1<300)

--
Regards

Roger Govier


"Rick Rothstein (MVP - VB)" wrote in
message ...
how do i do a if A1 200 and <300 return A1 otherwise
return 0. i can't get the logic to work


Everyone has given you the IF function method, so let me be
different.<g

=A1*AND(A1200,A1<300)

Rick




Rick Rothstein \(MVP - VB\)

if 200 and <300 formula
 
Or even

=A1*(A1200)*(A1<300)


Yeah, I was going to post that with an explanation that understanding this
construction will be helpful in making use of such functions as SUMPRODUCT
later on; but I had to take care of something and couldn't get back to my
computer until just now.

Rick


Roger Govier

if 200 and <300 formula
 
Yes Rick, I posted in haste and should have explained to the OP that the
tests
(A1200)
(A1<300)
would lead to a True or False result.
When Multiplied together, the True's would be coerced to 1's and the
False's to 0's

Hence
A1*TRUE*TRUE becomes A1*1*1 which returns the value in A1
If either (or both) of the tests is False, then we get 0.
A1*0*1 = 0
A1*1*0 = 0

As you rightly say, understanding this principle, does help with the
understanding of other functions such as Sumproduct.

--
Regards

Roger Govier


"Rick Rothstein (MVP - VB)" wrote in
message ...
Or even

=A1*(A1200)*(A1<300)


Yeah, I was going to post that with an explanation that understanding
this construction will be helpful in making use of such functions as
SUMPRODUCT later on; but I had to take care of something and couldn't
get back to my computer until just now.

Rick




Rick Rothstein \(MVP - VB\)

if 200 and <300 formula
 
Yes Rick, I posted in haste and should have explained to the OP that the
tests
(A1200)
(A1<300)
would lead to a True or False result.
When Multiplied together, the True's would be coerced to 1's and the
False's to 0's

Hence
A1*TRUE*TRUE becomes A1*1*1 which returns the value in A1
If either (or both) of the tests is False, then we get 0.
A1*0*1 = 0
A1*1*0 = 0


I was going to make the OP look it up and try to decipher it... in thinking
about it, it is better that the explanation be given directly as you did...
good job there.

Rick



All times are GMT +1. The time now is 10:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com