+ Reply to Thread
Results 1 to 12 of 12

Excel 2007 : Array formulas condition problem-bug!

  1. #1
    Registered User
    Join Date
    01-02-2011
    Location
    Bratislava, Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Angry Array formulas condition problem-bug!

    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???

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Array formulas condition problem-bug!

    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

  3. #3
    Valued Forum Contributor squiggler47's Avatar
    Join Date
    02-17-2009
    Location
    Littleborough, UK
    MS-Off Ver
    Excel 3.0 to 2007+2010! (couldnt get 2.1 working)
    Posts
    1,013

    Re: Array formulas condition problem-bug!

    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!


  4. #4
    Valued Forum Contributor squiggler47's Avatar
    Join Date
    02-17-2009
    Location
    Littleborough, UK
    MS-Off Ver
    Excel 3.0 to 2007+2010! (couldnt get 2.1 working)
    Posts
    1,013

    Re: Array formulas condition problem-bug!

    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!

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Array formulas condition problem-bug!

    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

    Please Login or Register  to view this content.
    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

    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:

    Please Login or Register  to view this content.
    again though - we're not saying you should
    Last edited by DonkeyOte; 01-02-2011 at 12:02 PM. Reason: clarified & delimiters

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Array formulas condition problem-bug!

    Quote Originally Posted by squiggler47 View Post
    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!
    Darren, I don't think it would.

  7. #7
    Registered User
    Join Date
    01-02-2011
    Location
    Bratislava, Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Array formulas condition problem-bug!

    Quote Originally Posted by zbor View Post
    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
    and

    Quote Originally Posted by squiggler47 View Post
    Its not an array formula, it is only evaluating on the first cell, just enter it as a normal formula and copy down!
    I have it as a part of array formula, but this was the problem why whole formula didnt work so I have simplified it.

    Quote Originally Posted by DonkeyOte View Post
    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

    Please Login or Register  to view this content.
    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

    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:

    Please Login or Register  to view this content.
    again though - we're not saying you should
    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 perfectly But whats wierd that when I use one condition, it works:

    Please Login or Register  to view this content.
    Last edited by luckylooke; 01-02-2011 at 12:32 PM.

  8. #8
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Array formulas condition problem-bug!

    Quote Originally Posted by luckylooke View Post
    whats wierd that when I use one condition, it works
    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})

  9. #9
    Valued Forum Contributor squiggler47's Avatar
    Join Date
    02-17-2009
    Location
    Littleborough, UK
    MS-Off Ver
    Excel 3.0 to 2007+2010! (couldnt get 2.1 working)
    Posts
    1,013

    Re: Array formulas condition problem-bug!

    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

  10. #10
    Valued Forum Contributor squiggler47's Avatar
    Join Date
    02-17-2009
    Location
    Littleborough, UK
    MS-Off Ver
    Excel 3.0 to 2007+2010! (couldnt get 2.1 working)
    Posts
    1,013

    Re: Array formulas condition problem-bug!

    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!

  11. #11
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Array formulas condition problem-bug!

    My guess is it's simply the age old issue of using ORs in Arrays

    Please Login or Register  to view this content.
    would work just as well (conducting OR by addition)
    Last edited by DonkeyOte; 01-02-2011 at 01:12 PM.

  12. #12
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Array formulas condition problem-bug!

    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 02:17 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1