I am using Excel 2007 with slovak regional settings so my in-function separator is semicolon ";" instead of colon "," and here is my problem:
When I select range A1:A5 and then put formula: =IF(OR(ROW()=1;ROW()=3);1;0)
with keys CTRL+SHIFT+ENTER to make it array formula
all I get is ONEs form A1 to A5 even when condition is evaluated as FALSE, excel put there 1 instead of 0
Any solution???![]()
Actually, it's not an array... It can be entered with normal Enter.
So select A1 to A5 and comfirm with Ctrl+Enter (without shift)...
And it will work.
Or put in first row (with normal enter) and pull down.
But you are right, it will evaluate 1 even it's FALSE
"Relax. What is mind? No matter. What is matter? Never mind!"
Its not an array formula, it is only evaluating on the first cell, just enter it as a normal formula and copy down!
Regards
Darren
Update 12-Nov-2010 Still job hunting!
If you are happy with the results, please add to our reputation by clicking the blue scales icon in the blue bar of the post.
Learn something new each day, Embrace change do not fear it, evolve and do not become extinct!
it would work if you put row($a$1:$a$5) in to replace the two row() parts, but its redundant array formulas should be used as a last resort!
Regards
Darren
Update 12-Nov-2010 Still job hunting!
If you are happy with the results, please add to our reputation by clicking the blue scales icon in the blue bar of the post.
Learn something new each day, Embrace change do not fear it, evolve and do not become extinct!
As outlined above the Array isn't necessary but in terms of explanation...
First off - it's not a bug
ROW returns an Array at all times - a cell can only display 1 item so though ROW is returning an Array of values the cell itself will only display 1 item (relative to index pos. etc)
This is why
applied to A1:A5 as an Array displays 1 to 5 - yet if you F9 on any of the cells formulae from within the Formula Bar you will note {1;2;3;4;5} displays in the Formula Bar=ROW(A1:A5)
For this reason your tests all return 1 because in each Array there is a 1 and a 3 and thus the OR is always true.
To get 1s and 0s using Array entry you could use:
again though - we're not saying you should=IF(OR(ROWS(A$1:INDEX($A:$A;ROW()))={1\3});1;0) or =OR(ROWS(A$1:INDEX($A:$A;ROW()))={1\3})+0
Last edited by DonkeyOte; 01-02-2011 at 11:02 AM. Reason: clarified & delimiters
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
and
I have it as a part of array formula, but this was the problem why whole formula didnt work so I have simplified it.
Thanks for your answer the fact that ROW() returns array is the reason why it was faulty... I didnt realised it... thanks again
PS: Your solution with ROWS function works perfectlyBut whats wierd that when I use one condition, it works:
=IF(ROW()=3;1;0)
Last edited by luckylooke; 01-02-2011 at 11:32 AM.
So it does... ok this leads me to believe that what I wrote above is in the truest sense of the word - nonsense - at least in this context
(ROW does return an Array though at all times)
I'm not savvy enough to know why the OR would cause the Array to be evaluated differently however - I will ask others it the guys here don't have an explanation.
(ie rather than {2} I presume it must be being processed as {1;2;3;4;5})
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
I think the problem is that OR takes array arguments, so it evaluates the 2 expressions into 2 arrays and evaluates all 10 with an or, since there is always a 3 and a 1 it has to return true
Regards
Darren
Update 12-Nov-2010 Still job hunting!
If you are happy with the results, please add to our reputation by clicking the blue scales icon in the blue bar of the post.
Learn something new each day, Embrace change do not fear it, evolve and do not become extinct!
I dindt quite word that right!
because the OR can take arguments as an array, it over rides the array formula use of the arrays!
Regards
Darren
Update 12-Nov-2010 Still job hunting!
If you are happy with the results, please add to our reputation by clicking the blue scales icon in the blue bar of the post.
Learn something new each day, Embrace change do not fear it, evolve and do not become extinct!
My guess is it's simply the age old issue of using ORs in Arrays
would work just as well (conducting OR by addition){=(ROW()=1)+(ROW()=3)}
Last edited by DonkeyOte; 01-02-2011 at 12:12 PM.
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
Or this (for this particular case, your is more general):
=ABS(2-ROW())=1
Also, sorry if I miss explanation, user said (and I also get evaluating formula) that he get (in step before last):
=IF(FALSE, 1, 0) returns 1
Last edited by zbor; 01-02-2011 at 01:17 PM.
"Relax. What is mind? No matter. What is matter? Never mind!"
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks