+ Reply to Thread
Results 1 to 7 of 7

Referencing previous column in COUNTIF

  1. #1

    Referencing previous column in COUNTIF

    Evening All,

    I am a novice Excel user, so please excuse the probably very basic
    question. I have a spreadsheet with two columns, e.g.

    A E
    D E
    F L
    A E
    G E

    I am trying to get some totals for column 2 based on the value, so I
    used COUNTIF(D4:D34, "E"). This is great, but I only want to count
    column 2 if the corresponding cell in column 1 is "A" (or not "A" for
    my other total). I think I want to somehow use INDIRECT as well, but
    can't quite figure out how! The total I am looking for in the example
    would be 2 (col2="E" and col1="A").

    Thanks for any hints/advice.

    Cheers,
    Al.


  2. #2
    Bob Phillips
    Guest

    Re: Referencing previous column in COUNTIF

    =SUMPRODUCT(--(A1:A10="A"),--(B1:B10-"E"))

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    <[email protected]> wrote in message
    news:[email protected]...
    > Evening All,
    >
    > I am a novice Excel user, so please excuse the probably very basic
    > question. I have a spreadsheet with two columns, e.g.
    >
    > A E
    > D E
    > F L
    > A E
    > G E
    >
    > I am trying to get some totals for column 2 based on the value, so I
    > used COUNTIF(D4:D34, "E"). This is great, but I only want to count
    > column 2 if the corresponding cell in column 1 is "A" (or not "A" for
    > my other total). I think I want to somehow use INDIRECT as well, but
    > can't quite figure out how! The total I am looking for in the example
    > would be 2 (col2="E" and col1="A").
    >
    > Thanks for any hints/advice.
    >
    > Cheers,
    > Al.
    >




  3. #3
    Jambruins
    Guest

    RE: Referencing previous column in COUNTIF

    Try this:

    =countif(D4:D34, "E") + countif(A4:A34, "A")



    "[email protected]" wrote:

    > Evening All,
    >
    > I am a novice Excel user, so please excuse the probably very basic
    > question. I have a spreadsheet with two columns, e.g.
    >
    > A E
    > D E
    > F L
    > A E
    > G E
    >
    > I am trying to get some totals for column 2 based on the value, so I
    > used COUNTIF(D4:D34, "E"). This is great, but I only want to count
    > column 2 if the corresponding cell in column 1 is "A" (or not "A" for
    > my other total). I think I want to somehow use INDIRECT as well, but
    > can't quite figure out how! The total I am looking for in the example
    > would be 2 (col2="E" and col1="A").
    >
    > Thanks for any hints/advice.
    >
    > Cheers,
    > Al.
    >
    >


  4. #4
    Peo Sjoblom
    Guest

    Re: Referencing previous column in COUNTIF

    =SUMPRODUCT(--(A2:A100="A"),--(B2:B100="E"))

    will count "E" in B where A is "A"


    --

    Regards,

    Peo Sjoblom


    <[email protected]> wrote in message
    news:[email protected]...
    > Evening All,
    >
    > I am a novice Excel user, so please excuse the probably very basic
    > question. I have a spreadsheet with two columns, e.g.
    >
    > A E
    > D E
    > F L
    > A E
    > G E
    >
    > I am trying to get some totals for column 2 based on the value, so I
    > used COUNTIF(D4:D34, "E"). This is great, but I only want to count
    > column 2 if the corresponding cell in column 1 is "A" (or not "A" for
    > my other total). I think I want to somehow use INDIRECT as well, but
    > can't quite figure out how! The total I am looking for in the example
    > would be 2 (col2="E" and col1="A").
    >
    > Thanks for any hints/advice.
    >
    > Cheers,
    > Al.
    >




  5. #5
    Domenic
    Guest

    Re: Referencing previous column in COUNTIF

    Try the following...

    =SUMPRODUCT(--(C4:C34="A"),--(D4:D34="E"))

    Hope this helps!

    In article <[email protected]>,
    "[email protected]" <[email protected]> wrote:

    > Evening All,
    >
    > I am a novice Excel user, so please excuse the probably very basic
    > question. I have a spreadsheet with two columns, e.g.
    >
    > A E
    > D E
    > F L
    > A E
    > G E
    >
    > I am trying to get some totals for column 2 based on the value, so I
    > used COUNTIF(D4:D34, "E"). This is great, but I only want to count
    > column 2 if the corresponding cell in column 1 is "A" (or not "A" for
    > my other total). I think I want to somehow use INDIRECT as well, but
    > can't quite figure out how! The total I am looking for in the example
    > would be 2 (col2="E" and col1="A").
    >
    > Thanks for any hints/advice.
    >
    > Cheers,
    > Al.


  6. #6

    Re: Referencing previous column in COUNTIF

    Thanks everyone for all your help there - superb! Just one question,
    what does '--(C4:C34="A")' do - is it some method of creating an array
    from the cells?

    Thanks again,
    Al.


  7. #7
    Bob Phillips
    Guest

    Re: Referencing previous column in COUNTIF

    See http://www.xldynamic.com/source/xld.SUMPRODUCT.html for an explanation

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    <[email protected]> wrote in message
    news:[email protected]...
    > Thanks everyone for all your help there - superb! Just one question,
    > what does '--(C4:C34="A")' do - is it some method of creating an array
    > from the cells?
    >
    > Thanks again,
    > Al.
    >




+ 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