+ Reply to Thread
Results 1 to 10 of 10

countif/criteria

  1. #1
    Registered User
    Join Date
    02-10-2007
    Posts
    97

    countif/criteria

    Guys,need help with a task for countif.the formula i have here on a data worksheet runs over 7 days each day on a seperate work sheet.what i need to do is be able to change the aylesford to say stora without manually typing each one in time consuming would you say i have abot 12 differrent names to insert. can anybody help.if i try to change it just gives me saturday

    cheers

    =COUNTIF(Sunday!$C$23,"Aylesford")+COUNTIF(Monday!$C$23,"Aylesford")+COUNTIF(Tuesday!$C$23,"Aylesford")+COUNTIF(Wednesday!$C$23,"Aylesford")+COUNTIF(Thursday!$C$23,"Aylesford")+COUNTIF(Friday!$C$23,"Aylesford")+COUNTIF(Saturday!$C$23,"Aylesford")
    Last edited by dodger999; 07-10-2009 at 05:01 AM.

  2. #2
    Registered User
    Join Date
    02-10-2007
    Posts
    97

    Re: countif/criteria

    i have zipped a file just to show the formulas,each block needs a name change block 1 (aylesford)is correct need block 2 (abitibi) block 3 say(Stora)
    etc hope this simplifies it a bit more

    once again thanks
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: countif/criteria

    COUNIF is generally used for a range of cells, not just one Cell.
    You may be able to use a simpler formula.
    Your example doesn't have the other sheets.
    Post an example with other sheets and some data [even if it's fake], just to show what you are expecting as your result.
    It's not easy to see what you're doing when all your formulas have #REF!.
    modytrane.

  4. #4
    Registered User
    Join Date
    02-10-2007
    Posts
    97

    Re: countif/criteria

    have replaced with a new report eventually i will have to complete all boxes with information so if there is a quicker way it will be greatly appreciated ...many thanks
    Attached Files Attached Files

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

    Re: countif/criteria

    A COUNTIF criteria value need not be a constant, that is a hard-wired value - it can be a cell reference - and thus the cell reference can adapt as the formula is copied across cells.

    If for ex. we look at Data!B3 we have:

    =COUNTIF(Sunday!$C$21,"Aylesford")+COUNTIF(Monday!$C$21,"Aylesford")+COUNTIF(Tuesday!$C$21,"Aylesford")...etc

    but this could be re-written based on the fact that B1 contains Aylesford, ie:

    =COUNTIF(Sunday!$C$21,B$1)+COUNTIF(Monday!$C$21,B$1)+COUNTIF(Tuesday!$C$21,B$1)...etc

    for C3 which references K

    =COUNTIF(Sunday!$K$21,B$1)+COUNTIF(Monday!$K$21,B$1)+COUNTIF(Tuesday!$K$21,B$1)...etc

    Given each row is referencing a different cell (and there is no even pattern between them) you will need B in each row separately before applying across the remaining columns.

    Before others suggest the same - you could use INDIRECT but this would make things more complex and Volatile so better IMO to setup as above.

    As for embedding all the COUNTIFs - yes, unfortunately XL does not permit 3D conditional summation, requiring Volatile Sumproduct/Arrays instead and these are not good performers... and so in the face of that I think the approach you have adopted is not a bad one.
    Last edited by DonkeyOte; 07-02-2009 at 04:05 AM.

  6. #6
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: countif/criteria

    With truly high respects to DonkeyOte I have interpreted it a little bit different and came up with folowing solution:

    =SUMPRODUCT((COUNTIF(INDIRECT("'"&mysheets&"'!$C$23"),"Aylesford")))

    where mysheets is defined as

    ={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"}

    Cheers
    Last edited by rwgrietveld; 07-02-2009 at 04:45 AM.
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  7. #7
    Registered User
    Join Date
    02-10-2007
    Posts
    97

    Re: countif/criteria

    Ok guys i get Donkeyote answer seems pretty straight forward still quite a bit of manual imput but a lot easier i guess thanks for that one but im kinda lost on the next solution being a bit of a novice on excel im afraid

  8. #8
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: countif/criteria

    I've made the complete wb a little bit more dynamic.

    Please take a look.

    NOTE: I see you have numerous merged cells. Try to avoid these.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    02-10-2007
    Posts
    97

    Re: countif/criteria

    My word i havnt got a clue how you did that,i cant even work it out reading it but its very good thankyou,now if i could understand it i could learn it lol

  10. #10
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: countif/criteria

    We are here "ter leeringh ende vermaek". It's Dutch and means that we are here to learn and have fun doing it.

    If you have a specific question please ask (maybe new topic as an answer is expected to come much faster). Try to understand what we have done as a lot of this stuff is reoccuring in this forum.

+ 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