+ Reply to Thread
Results 1 to 9 of 9

Comparing 2 or more columns and returning a true value

  1. #1
    Registered User
    Join Date
    02-06-2009
    Location
    Hastings, England
    MS-Off Ver
    Excel 2003
    Posts
    10

    Comparing 2 or more columns and returning a true value

    Hi Guys,

    I'm quite new to array formulas in excel and was wondering whether or not I can advance on this formula:

    =AND($C$5=B7,$K$5=G5)

    The problem is I would like to compare the entire colums (or array) and return the number of 'TRUE' statements in the array as a value.

    =AND($C$5:$C$65536=B7,$K$5:$K$65536=G5)

    however, this returns all values as 'FALSE'

    example of arrgument:

    IF C5:C65535=customer then count how many cells in K5:K65536=completed

    Any advice greatly welcomed.

    Cheers

    Stu
    Last edited by stujordan; 02-10-2009 at 09:25 AM.

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

    Re: Compareing 2 or more Colums and Returning a True Value

    Keep you range sizes to a minimum when dealing with arrays... build in some excess capacity but don't use include vast numbers of blank rows.

    Please Login or Register  to view this content.
    Pre 2007 you can't use entire column references - ie C:C

    EDIT: I'm also going to get into trouble for replying as this is plainly in the wrong forum (I've just discovered) ... please PM a Mod and ask that they move it for you to the appropriate forum (namely Worksheet Functions)
    Last edited by DonkeyOte; 02-10-2009 at 05:20 AM.

  3. #3
    Registered User
    Join Date
    02-06-2009
    Location
    Hastings, England
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Comparing 2 or more columns and returning a true value

    It's returns a value which is good, however all the values are '0', what values should replace the '- -',

    Thanks

    Stu

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

    Re: Comparing 2 or more columns and returning a true value

    I don't understand your question at all I'm afraid.

  5. #5
    Registered User
    Join Date
    02-06-2009
    Location
    Hastings, England
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Comparing 2 or more columns and returning a true value

    Sorry! The formula you suggested is returning 0 values - where by the data i've entered it should be giving me a positive number.

    In the code you posted there are '- -' symbols what do they relate to?

    Hope this makes more sence!

    Stu

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

    Re: Comparing 2 or more columns and returning a true value

    -- is the double unary operator and is used to coerce the Boolean results of the tests
    (ie x = y will return TRUE/FALSE ... --(TRUE/FASLE) => 1/0 respectively)

    If you're getting a 0 result it's because the criteria values (B7, G5) do not match the values in the ranges specified (C and K respectively).

    We could begin a long thread now trying to establish the cause be it trailing spaces, differing data types etc but the simplest thing would be to post a small sample file so I can see with my own eyes.

  7. #7
    Registered User
    Join Date
    02-06-2009
    Location
    Hastings, England
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Comparing 2 or more columns and returning a true value

    Ok as requested a simplified form of my worksheet.

    Where the data sheet holds. the majority of the date and the overview sheet displays a quick reference to whats going on.

    The overview sheet wants to the user how many entries are of a certain status based on the source.

    Does this make sense?

    Stu
    Attached Files Attached Files

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

    Re: Comparing 2 or more columns and returning a true value

    The formula you entered

    Please Login or Register  to view this content.
    bears virtually no relation to that offered.

    It should be:

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    02-06-2009
    Location
    Hastings, England
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Comparing 2 or more columns and returning a true value

    Perfect!

    Sorry my apologies for not reading your post correctly and wasting time!

    Many Thanks,

    Stu

+ 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