ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Help simplifying IF OR formula (https://www.excelbanter.com/excel-worksheet-functions/231499-help-simplifying-if-formula.html)

Divya

Help simplifying IF OR formula
 
Hi,

Can I write this a better/simpler way?

IF(OR(A2=$A$1, B2 = $A$1, C2 = $A$1, D2= $A$1),1,0)

Basically comparing a range of cells to one value and returning 1 if true,
and 0 if false

Much appreciated!

Teethless mama

Help simplifying IF OR formula
 
=(COUNTIF(A2:D2,A1)0)+0


"Divya" wrote:

Hi,

Can I write this a better/simpler way?

IF(OR(A2=$A$1, B2 = $A$1, C2 = $A$1, D2= $A$1),1,0)

Basically comparing a range of cells to one value and returning 1 if true,
and 0 if false

Much appreciated!


T. Valko

Help simplifying IF OR formula
 
Maybe this:

=--(COUNTIF(A2:D2,$A$1)0)

--
Biff
Microsoft Excel MVP


"Divya" wrote in message
...
Hi,

Can I write this a better/simpler way?

IF(OR(A2=$A$1, B2 = $A$1, C2 = $A$1, D2= $A$1),1,0)

Basically comparing a range of cells to one value and returning 1 if true,
and 0 if false

Much appreciated!




Rick Rothstein

Help simplifying IF OR formula
 
While I would go with the COUNTIF method already posted, I just thought it
interesting that this simple array-entered** formula works also...

=OR($A$1=A2:D2)

**Commit formula using Ctrl+Shift+Enter, not just Enter by itself.

--
Rick (MVP - Excel)


"Divya" wrote in message
...
Hi,

Can I write this a better/simpler way?

IF(OR(A2=$A$1, B2 = $A$1, C2 = $A$1, D2= $A$1),1,0)

Basically comparing a range of cells to one value and returning 1 if true,
and 0 if false

Much appreciated!



Teethless mama

Help simplifying IF OR formula
 
This one doesn't required "array-entered"

=--OR(INDEX(A2:D2=$A$1,))


"Rick Rothstein" wrote:

While I would go with the COUNTIF method already posted, I just thought it
interesting that this simple array-entered** formula works also...

=OR($A$1=A2:D2)

**Commit formula using Ctrl+Shift+Enter, not just Enter by itself.

--
Rick (MVP - Excel)


"Divya" wrote in message
...
Hi,

Can I write this a better/simpler way?

IF(OR(A2=$A$1, B2 = $A$1, C2 = $A$1, D2= $A$1),1,0)

Basically comparing a range of cells to one value and returning 1 if true,
and 0 if false

Much appreciated!




Rick Rothstein

Help simplifying IF OR formula
 
But it is SO much longer... <bg

--
Rick (MVP - Excel)


"Teethless mama" wrote in message
...
This one doesn't required "array-entered"

=--OR(INDEX(A2:D2=$A$1,))


"Rick Rothstein" wrote:

While I would go with the COUNTIF method already posted, I just thought
it
interesting that this simple array-entered** formula works also...

=OR($A$1=A2:D2)

**Commit formula using Ctrl+Shift+Enter, not just Enter by itself.

--
Rick (MVP - Excel)


"Divya" wrote in message
...
Hi,

Can I write this a better/simpler way?

IF(OR(A2=$A$1, B2 = $A$1, C2 = $A$1, D2= $A$1),1,0)

Basically comparing a range of cells to one value and returning 1 if
true,
and 0 if false

Much appreciated!





mubashir aziz[_26_]

Help simplifying IF OR formula
 

@ Mama you formula is cool .......

@Rick your formula is short but will not return 1 or 0 until & unless
you will use negation ....

=--(OR($A$1=A2:D2))
press Ctrl+Shift+Enter (CSE)



Teethless mama;352666 Wrote: [color=blue]
This one doesn't required "array-entered"

=--OR(INDEX(A2:D2=$A$1,))


"Rick Rothstein" wrote:

While I would go with the COUNTIF method already posted, I just

thought it
interesting that this simple array-entered** formula works also...

=OR($A$1=A2:D2)

**Commit formula using Ctrl+Shift+Enter, not just Enter by itself.

--
Rick (MVP - Excel)




--
mubashir aziz

If this post helps Don't 4get to click Yes
------------------------------------------------------------------------
mubashir aziz's Profile: http://www.thecodecage.com/forumz/member.php?userid=237
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=98697



All times are GMT +1. The time now is 03:50 AM.

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