+ Reply to Thread
Results 1 to 4 of 4

OR(INDIRECT(....ROW() array problem

  1. #1
    Registered User
    Join Date
    07-17-2012
    Location
    Oxford
    MS-Off Ver
    Excel 2010
    Posts
    2

    Question OR(INDIRECT(....ROW() array problem

    Hi All

    Just been trying to compare a cell value to all cells below that one in a list. The list can vary in length, so I use COUNTA($A:$A) to provide the right figure.

    The formula I have used, on a set of dummy data, returns value error when I reference the ROW()+1 (to define the cell below the reference), yet is fine if I hard code in a number, say 3 or even refer it to a third cell which contains ROW()+1

    To explain a bit more, this works:

    ={IF(OR(INDIRECT("$a"&E1&":$a$"&COUNTA(A:A))="d"),"Y","N")} where E1 contains =ROW()+1

    and this works:


    ={IF(OR(INDIRECT("$a"&6&":$a$"&COUNTA(A:A))="d"),"Y","N")}


    but this doesn't:

    ={IF(OR(INDIRECT("$a"&(ROW()+1)&":$a$"&COUNTA(A:A))="d"),"Y","N")}


    DOes anyone know why this third one (which is the ideal solution) does not work? I have tried using VALUE and TEXT to force the format with no joy, even ROW(A:A)

    Many thanks in advance


    Andy

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: OR(INDIRECT(....ROW() array problem

    Using E1 works because E1 will always contain the value 2

    When you enter the Row()+1 directly in the formula it returns the number of the row immediately below the cell in which you enter the formula.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: OR(INDIRECT(....ROW() array problem

    why not use
    =IF(OR(A2:INDEX(A:A,COUNTA(A:A))=A1),"y","n") which you can drag down
    or just =if(countif(a2:$a$10000,a1),"y","n") which you can also drag down
    Last edited by martindwilson; 07-17-2012 at 08:23 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Registered User
    Join Date
    07-17-2012
    Location
    Oxford
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: OR(INDIRECT(....ROW() array problem

    Thanks for the speedy answers guys, I'll give the suggestions a go. I didn't think of using INDEX....!


    Regards


    Andy

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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