Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default 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!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default 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!

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default 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!



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,934
Default 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!


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default 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!





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,934
Default 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!




  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default 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

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
Simplifying/speeding up this formula Keith R Excel Worksheet Functions 5 August 17th 07 02:13 AM
Simplifying a formula MartinW Excel Worksheet Functions 3 June 19th 06 11:50 AM
Simplifying Formula (part 1) PaulW Excel Discussion (Misc queries) 2 April 21st 06 06:52 PM
Simplifying Formula (Part 2) PaulW Excel Discussion (Misc queries) 0 April 21st 06 04:53 PM
Simplifying formula m.cain Excel Discussion (Misc queries) 1 March 24th 06 11:35 AM


All times are GMT +1. The time now is 11:41 PM.

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

About Us

"It's about Microsoft Excel"