+ Reply to Thread
Results 1 to 7 of 7

Equations using arrays

  1. #1
    Registered User
    Join Date
    03-11-2013
    Location
    Edmonton, Canada
    MS-Off Ver
    Excel 2010
    Posts
    14

    Equations using arrays

    Hello,

    I'm having some trouble using arrays. The following example will help me explain my problem:

    COL A
    pen
    paper
    eraser
    pencil

    I would like to write a formula along the lines of:

    if("pen"=$A$2:$A$5,"Y","N")

    My hopes is that because "pen" is contained in the array this function would return "Y" but instead I get #VALUE!. This is what I get when i put the above example in verbatim. Any suggestions?
    Last edited by nikolasm; 05-07-2013 at 01:48 PM.

  2. #2
    Forum Contributor
    Join Date
    12-14-2012
    Location
    Doha, State of Qatar
    MS-Off Ver
    excel 2003, 2007, 2010, 2016
    Posts
    124

    Re: Equations using arrays

    try this:-

    if("pen"=$A$2:$A$5,"Y","N")

    this is because as you are using ":" in "$A:$5"
    Regards,
    abdul

  3. #3
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: Equations using arrays

    =IF(MATCH("paper",A2:A5,0)>0,"Yes","No")
    Elegant Simplicity............. Not Always

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Equations using arrays

    nikolasm,

    For something like this, there is no need for an array formula. Just use the Countif() function:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  5. #5
    Registered User
    Join Date
    03-11-2013
    Location
    Edmonton, Canada
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Equations using arrays

    Haha, yeah that was a typo That colon isn't there.

  6. #6
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Equations using arrays

    @AndyLitch, if there is no match, the MATCH function will return an error.

  7. #7
    Registered User
    Join Date
    03-11-2013
    Location
    Edmonton, Canada
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Equations using arrays

    Thanks AndyLinch and tigeravatar. That was easy!

    And yes, the match function returns #N/A if there no match.

+ 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