+ Reply to Thread
Results 1 to 6 of 6

IF statement question

  1. #1
    KarenH
    Guest

    IF statement question

    Can someone translate the following IF statement for me?

    =IF((A2<>"")*(ISNA(MATCH(A2,$A$1:A1,0))),"A","B")

    I'm confused abut the first part, specifically the asterisk separating the
    two criteria.
    Thanks!


  2. #2
    Franz Verga
    Guest

    Re: IF statement question

    Nel post news:[email protected]
    *KarenH* ha scritto:

    > Can someone translate the following IF statement for me?
    >
    > =IF((A2<>"")*(ISNA(MATCH(A2,$A$1:A1,0))),"A","B")
    >
    > I'm confused abut the first part, specifically the asterisk
    > separating the two criteria.
    > Thanks!


    Hi Karen,

    The formula can be written also in this way:

    =IF(AND((A2<>""),(ISNA(MATCH(A2,$A$1:A1,0)))),"A","B")

    Its mean that:

    IF A2<>"" (i.e. A2 is not empty)

    AND the value in A2 doesn't match the value in A1(the formula MATCH is used
    to search the value in A2 in A1, if the two values are different, MATCH
    function returns #N/A! error the formula ISNA convert the error in TRUE)

    THEN write A in the cell the formula is written

    ELSE write B in the cell.

    --
    Hope I helped you.

    Thanks in advance for your feedback.

    Ciao

    Franz Verga from Italy



  3. #3
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094
    Karen,

    =IF((A2<>"")*(ISNA(MATCH(A2,$A$1:A1,0))),"A","B")


    IF A2 is not blank AND (*) A2 is not (ISNA) found (MATCH) in the range
    $A$1:A1 then return the letter A IF both are not true then return the letter B. You could write the formula like this,

    =IF(AND(A2<>"",ISNA(MATCH(A2,$A$1:A1,0))),"A","B")

    Having the $ in the first A1 and not the second allows you to expand the range when you copy down without losing the starting point.

    HTH

    Steve

  4. #4
    KarenH
    Guest

    Re: IF statement question

    Thanks to Franz and SteveG for this explanation -- that helped a lot! I'd
    never seen the asterisk used as an "and" before, I always think of it as a
    multiplication symbol.

    I appreciate the helpful answers!



    "Franz Verga" wrote:

    > Nel post news:[email protected]
    > *KarenH* ha scritto:
    >
    > > Can someone translate the following IF statement for me?
    > >
    > > =IF((A2<>"")*(ISNA(MATCH(A2,$A$1:A1,0))),"A","B")
    > >
    > > I'm confused abut the first part, specifically the asterisk
    > > separating the two criteria.
    > > Thanks!

    >
    > Hi Karen,
    >
    > The formula can be written also in this way:
    >
    > =IF(AND((A2<>""),(ISNA(MATCH(A2,$A$1:A1,0)))),"A","B")
    >
    > Its mean that:
    >
    > IF A2<>"" (i.e. A2 is not empty)
    >
    > AND the value in A2 doesn't match the value in A1(the formula MATCH is used
    > to search the value in A2 in A1, if the two values are different, MATCH
    > function returns #N/A! error the formula ISNA convert the error in TRUE)
    >
    > THEN write A in the cell the formula is written
    >
    > ELSE write B in the cell.
    >
    > --
    > Hope I helped you.
    >
    > Thanks in advance for your feedback.
    >
    > Ciao
    >
    > Franz Verga from Italy
    >
    >
    >


  5. #5
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094
    You're welcome and thanks for the feedback.

    Steve

  6. #6
    Kevin Vaughn
    Guest

    Re: IF statement question

    Yes the * is the multiplication symbol. In this instance, it is multiplying
    two boolean values (true or false.) If both values are true, that works out
    to be the same as AND. True and True = True. True * True = 1 (which is
    true.) Anything else will be 0 or false. False * true (same as 0 * 1 and as
    we all know, 0 times anything is 0.) True * False or False * False will be 0
    (or false.)
    --
    Kevin Vaughn


    "KarenH" wrote:

    > Thanks to Franz and SteveG for this explanation -- that helped a lot! I'd
    > never seen the asterisk used as an "and" before, I always think of it as a
    > multiplication symbol.
    >
    > I appreciate the helpful answers!
    >
    >
    >
    > "Franz Verga" wrote:
    >
    > > Nel post news:[email protected]
    > > *KarenH* ha scritto:
    > >
    > > > Can someone translate the following IF statement for me?
    > > >
    > > > =IF((A2<>"")*(ISNA(MATCH(A2,$A$1:A1,0))),"A","B")
    > > >
    > > > I'm confused abut the first part, specifically the asterisk
    > > > separating the two criteria.
    > > > Thanks!

    > >
    > > Hi Karen,
    > >
    > > The formula can be written also in this way:
    > >
    > > =IF(AND((A2<>""),(ISNA(MATCH(A2,$A$1:A1,0)))),"A","B")
    > >
    > > Its mean that:
    > >
    > > IF A2<>"" (i.e. A2 is not empty)
    > >
    > > AND the value in A2 doesn't match the value in A1(the formula MATCH is used
    > > to search the value in A2 in A1, if the two values are different, MATCH
    > > function returns #N/A! error the formula ISNA convert the error in TRUE)
    > >
    > > THEN write A in the cell the formula is written
    > >
    > > ELSE write B in the cell.
    > >
    > > --
    > > Hope I helped you.
    > >
    > > Thanks in advance for your feedback.
    > >
    > > Ciao
    > >
    > > Franz Verga from Italy
    > >
    > >
    > >


+ 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