+ Reply to Thread
Results 1 to 6 of 6

Need to count if X = 1.2 and Y = green... help

  1. #1
    Registered User
    Join Date
    05-26-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    5

    Question Need to count if X = 1.2 and Y = green... help

    Hello
    I wonder if somebody could correct my formula here as I'm not quite sure where I have gone wrong.
    I have a set of data as below:
    Number / Status
    1.2 / Red
    1.2 / Green
    1.2 / Amber
    1.3 / Green

    In another sheet I want to pull back the number of times where 1.2 AND Green occur. So in the above example the answer should be 1.

    I have:
    =(((COUNTIF('sheet1'!A:A,"1.2")*AND(COUNTIF('sheet1'!J:J,"Green")))))
    where sheet1 is my sheet name and A:A is the column that 1.2/1.3 appear in and J:J the column where the colour appears, but this is not showing the correct answer...

    Thanks

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Need to count if X = 1.2 and Y = green... help

    Several issues
    1.2 should not be in quotes.
    You want to use COUNTIFS (which is available in 2007) not the AND
    =COUNTIFS('sheet1'!A:A,1.2,'sheet1'!J:J,"Green")
    Last edited by ChemistB; 05-26-2011 at 08:05 AM.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

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

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Need to count if X = 1.2 and Y = green... help

    Since you have Excel 2007, Try:

    =COUNTIFS('sheet1'!A:A,"1.2",'sheet1'!J:J,"Green")
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Need to count if X = 1.2 and Y = green... help

    Since you have Excel 2007, Try:

    =COUNTIFS('sheet1'!A:A,"1.2",'sheet1'!J:J,"Green")

  5. #5
    Registered User
    Join Date
    05-26-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Need to count if X = 1.2 and Y = green... help

    How about if I wanted to pull through

    When 1.2 appears in column A, and Red, Green or Amber appear in column J - and I want to formula to bring back the colour that appears most frequently in column J (but only where column A=1.2).

    Thanks... sorry, I've been staring at spreadsheets for too long today and I've lost the plot!

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Need to count if X = 1.2 and Y = green... help

    Try something like:

    =INDEX($J$1:$J$100,MODE(IF($A$1:$A$100="1.2",MATCH($J$1:$J$100,$J$1:$J$100,0))))

    adjust ranges to suit. (don't use whole columns) and then confirm the formula with CTRL+SHIFT+ENTER not just ENTER.

    Note: If the 1.2 is in fact a number entry and not a text, then remove the quotes.

+ 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