Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Scott P
 
Posts: n/a
Default Multiple OR function

Is there some way to consolidate a function such as this:
=IF(OR(A1=5,B1=5,C1=5,D1=5,E1=5),5,0)? I want to see if any one of a
non-contiguous range of cells is equal to a fixed value. I would like to
input the fixed value only one time into the function if possible.

Thanks.
  #2   Report Post  
Peo Sjoblom
 
Posts: n/a
Default

In your example you aren using a contiguous range, if that's the case use

=(COUNTIF(A1:E1,5)0)*5

if you really meant non-contiguous range as in A1, C1, E4 etc you can select
all cells in question (hold down ctrl while selecting them) then do
insertnamedefine and name them to let's say MyRange, then you can use

=(SUMPRODUCT(--(LARGE(MyRange,ROW(INDIRECT("1:"&COUNT(MyRange)))) =5))0)*5

note that the latter will return an error if all cells are blank or if it no
numbers in the cells




Regards,

Peo Sjoblom

"Scott P" wrote:

Is there some way to consolidate a function such as this:
=IF(OR(A1=5,B1=5,C1=5,D1=5,E1=5),5,0)? I want to see if any one of a
non-contiguous range of cells is equal to a fixed value. I would like to
input the fixed value only one time into the function if possible.

Thanks.

  #3   Report Post  
Jason Morin
 
Posts: n/a
Default

=IF(SUMPRODUCT(--(A1:A5=5)),5,0)

or

=SUMPRODUCT(--(A1:A5=5))*5

HTH
Jason
Atlanta, GA

-----Original Message-----
Is there some way to consolidate a function such as

this:
=IF(OR(A1=5,B1=5,C1=5,D1=5,E1=5),5,0)? I want to see if

any one of a
non-contiguous range of cells is equal to a fixed

value. I would like to
input the fixed value only one time into the function if

possible.

Thanks.
.

  #4   Report Post  
Dana DeLouis
 
Posts: n/a
Default

Just another option:

=5*OR(A1:E1=5)

Ctrl+Shift+Enter

HTH
--
Dana DeLouis
Win XP & Office 2003


"Scott P" wrote in message
...
Is there some way to consolidate a function such as this:
=IF(OR(A1=5,B1=5,C1=5,D1=5,E1=5),5,0)? I want to see if any one of a
non-contiguous range of cells is equal to a fixed value. I would like to
input the fixed value only one time into the function if possible.

Thanks.



  #5   Report Post  
Scott P
 
Posts: n/a
Default

Thanks, Dana. I actually found this to work as well based upon your post:

=IF(OR(A1:E1=5),1,0) --- this is entered as an array (CTRL+SHIFT+ENTER)

"Dana DeLouis" wrote:

Just another option:

=5*OR(A1:E1=5)

Ctrl+Shift+Enter

HTH
--
Dana DeLouis
Win XP & Office 2003


"Scott P" wrote in message
...
Is there some way to consolidate a function such as this:
=IF(OR(A1=5,B1=5,C1=5,D1=5,E1=5),5,0)? I want to see if any one of a
non-contiguous range of cells is equal to a fixed value. I would like to
input the fixed value only one time into the function if possible.

Thanks.






  #6   Report Post  
Aladin Akyurek
 
Posts: n/a
Default



Scott P wrote:
Thanks, Dana. I actually found this to work as well based upon your post:

=IF(OR(A1:E1=5),1,0) --- this is entered as an array (CTRL+SHIFT+ENTER)

[...]

If that's what you want, the following would be less costly:

=--ISNUMBER(MATCH(5,A1:E1,0))
  #7   Report Post  
Tushar Mehta
 
Posts: n/a
Default

In article ,
says...
Thanks, Dana. I actually found this to work as well based upon your post:

=IF(OR(A1:E1=5),1,0) --- this is entered as an array (CTRL+SHIFT+ENTER)

Yes! Obvious, straightforward, and to the point!

It seems that lately 'experts' have fallen so much in love with their
own technical complexities that they seem to overlook the obvious
solution that also happen to be transparent, simple, and easy to
understand.

Of course, no one except Peo addressed the original point about non-
contiguous ranges. And, honestly, I prefer spelling out the condition
with something like

=IF(OR(A1:E1=5,G1:K1=5),5,0)

to Peo's

=(SUMPRODUCT(--(LARGE(MyRange,ROW(INDIRECT("1:"&COUNT(MyRange)))) =5))
0)*5

which I won't even attempt to understand. <g

[OK, OK, that's not true. It's not *that* difficult to figure out and
is a slick way to get to every numeric value in a non-contiguous range.
Though, I still dislike the current love affair with double-negation
and SUMPRODUCT. The array formula =OR(LARGE(myRng,ROW(INDIRECT
("1:"&COUNT(myRng))))=5) works just nicely, thank you.]

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
Thanks, Dana. I actually found this to work as well based upon your post:

=IF(OR(A1:E1=5),1,0) --- this is entered as an array (CTRL+SHIFT+ENTER)

"Dana DeLouis" wrote:

Just another option:

=5*OR(A1:E1=5)

Ctrl+Shift+Enter

HTH
--
Dana DeLouis
Win XP & Office 2003


"Scott P" wrote in message
...
Is there some way to consolidate a function such as this:
=IF(OR(A1=5,B1=5,C1=5,D1=5,E1=5),5,0)? I want to see if any one of a
non-contiguous range of cells is equal to a fixed value. I would like to
input the fixed value only one time into the function if possible.

Thanks.





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
Formula to list unique values JaneC Excel Worksheet Functions 4 December 10th 04 12:25 AM
Multiple Worksheets and Print Merge function pfe Excel Discussion (Misc queries) 2 December 2nd 04 11:23 PM
Need Function for adding rows on multiple sheets... struggling rookie ;) Thanks. Steve Excel Worksheet Functions 6 November 24th 04 12:10 AM
Sum function on multiple date fields rbrooks Excel Worksheet Functions 1 October 28th 04 09:56 PM
SUMIF(AND) FUNCTION Saariko Excel Worksheet Functions 9 October 28th 04 11:52 AM


All times are GMT +1. The time now is 02:13 AM.

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

About Us

"It's about Microsoft Excel"