ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Returning a value when 2 other values are true (https://www.excelbanter.com/excel-worksheet-functions/239702-returning-value-when-2-other-values-true.html)

Lman

Returning a value when 2 other values are true
 
I know how to use an IF statement to return a value from a cell B if cell A
is true (for example =IF(A1=100,B3,"no value found"). However i need to
compare 2 values and return a 3rd if both values are true. For example, If
cell A is 100 and cell B is <200 then return cell c.



Bernard Liengme[_3_]

Returning a value when 2 other values are true
 
=IF(AND(A1100,B1<200),C1,"Two conditions not met")
but more realistically
=IF(AND(A1100,B1<200),C1,"")
which give either C1 or makes the cell appear blank

If you are happy with getting zero when the two conditions are not meet, you
can avoid IF
=(A1100)*(B1<200)*C1

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email


"Lman" wrote in message
...
I know how to use an IF statement to return a value from a cell B if cell
A
is true (for example =IF(A1=100,B3,"no value found"). However i need to
compare 2 values and return a 3rd if both values are true. For example, If
cell A is 100 and cell B is <200 then return cell c.




Bernd P

Returning a value when 2 other values are true
 
Hello,

The boring solution:
=If(And(A1100,B1<200),C1)

The funny solution:
[text result] =REPT(C1,(A1100)*(B1<200))
[value result] =--REPT(C1,(A1100)*(B1<200))

Regards,
Bernd

Lman

Returning a value when 2 other values are true
 
Thanks!! that was exactly what i was looking for, in fact posting a zero when
the conditions are not met is even better.



"Bernard Liengme" wrote:

=IF(AND(A1100,B1<200),C1,"Two conditions not met")
but more realistically
=IF(AND(A1100,B1<200),C1,"")
which give either C1 or makes the cell appear blank

If you are happy with getting zero when the two conditions are not meet, you
can avoid IF
=(A1100)*(B1<200)*C1

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email


"Lman" wrote in message
...
I know how to use an IF statement to return a value from a cell B if cell
A
is true (for example =IF(A1=100,B3,"no value found"). However i need to
compare 2 values and return a 3rd if both values are true. For example, If
cell A is 100 and cell B is <200 then return cell c.





Bernard Liengme[_3_]

Returning a value when 2 other values are true
 
Glad to have helped!

--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email


"Lman" wrote in message
...
Thanks!! that was exactly what i was looking for, in fact posting a zero
when
the conditions are not met is even better.



"Bernard Liengme" wrote:

=IF(AND(A1100,B1<200),C1,"Two conditions not met")
but more realistically
=IF(AND(A1100,B1<200),C1,"")
which give either C1 or makes the cell appear blank

If you are happy with getting zero when the two conditions are not meet,
you
can avoid IF
=(A1100)*(B1<200)*C1

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email


"Lman" wrote in message
...
I know how to use an IF statement to return a value from a cell B if
cell
A
is true (for example =IF(A1=100,B3,"no value found"). However i need to
compare 2 values and return a 3rd if both values are true. For example,
If
cell A is 100 and cell B is <200 then return cell c.







All times are GMT +1. The time now is 08:26 AM.

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