ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   How to return a number instead of true/false with an if function? (https://www.excelbanter.com/new-users-excel/244235-how-return-number-instead-true-false-if-function.html)

charles

How to return a number instead of true/false with an if function?
 
Please help

kassie

How to return a number instead of true/false with an if function?
 
=IF(your condition,1,2)
eg =IF(A1=B1,1,2) will return a 1 if TRUE, and a 2 if FALSE

--
HTH

Kassie

Replace xxx with hotmail


"charles" wrote:

Please help


Max

How to return a number instead of true/false with an if function?
 
Always elaborate on your issue in the message area (that big white space).
The subject line's just that, meant to be brief keynotes on your issue. It's
NOT your query. Elaborate by posting your formula or your formula attempts
and by describing details of what you have (your sheet set-up, sample data)
and what you want to do/happen

Anyway, here's 2 simple IF examples to groove you in its use ..

In B2: =IF(A210,"Yes","No")
B2 will return "Yes" if the check [A210] evaluates to TRUE, "No" if FALSE

In B2: =IF(A210,200,A2)
B2 will return the number 200 if the check [A210] evaluates to TRUE. It'll
return the value in A2 if FALSE

Above any good? hit the YES below
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:27,000 Files:200 Subscribers:70
xdemechanik
---
"charles" wrote:
Please help


Ed Ferrero[_3_]

How to return a number instead of true/false with an if function?
 
Hi Charles,

You have had a couple of good answers already.

In general, if a function or expression evaluates to TRUE/FALSE, you can
convert it to 1/0 by multiplying by 1.

So
=A1=4
will return TRUE or FALSE depending on the value entered in cell A1, and
=1*(A1=4)
will return 1 or 0 based on the value in cell A1

That means that you can write
=IF(A1=B1,1,0)
or
=1*(A1=B1)
to show 1 or 0 if A1=B1

Ed Ferrero
www.edferrero.com



All times are GMT +1. The time now is 07:22 AM.

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