+ Reply to Thread
Results 1 to 22 of 22

Finding how many times a name appear in 4 sheets.. hard one! :)

  1. #1
    Forum Contributor
    Join Date
    10-28-2010
    Location
    quebec, canada
    MS-Off Ver
    o365
    Posts
    187

    Finding how many times a name appear in 4 sheets.. hard one! :)

    Hi everyone,

    I have 5 differents sheet in my excel file, i need to find a formula that will look into the sheet 1 to 4, and each time they see a specific name like "bobby", it count +1 on a "total" sheet on sheet 5.

    I don't know if it's clear for you guys, but i would appreciate a hint or some help on how to create this formula

  2. #2
    Valued Forum Contributor scottylad2's Avatar
    Join Date
    09-03-2010
    Location
    edinburgh
    MS-Off Ver
    Office 2007 Prof & Office 2010 Student Edition
    Posts
    629

    Re: Finding how many times a name appear in 4 sheets.. hard one! :)

    can you be a little clearer, where is the name likely to appear? is it in one column of names per sheet or anywhere at all? are the names contained within ranges?

    uploading a sample may help
    Windows 7 using Office 2007 & 2010

    Remember your [ code ] [ /code ] tags, makes reading soooo much easier

  3. #3
    Forum Contributor
    Join Date
    10-28-2010
    Location
    quebec, canada
    MS-Off Ver
    o365
    Posts
    187

    Re: Finding how many times a name appear in 4 sheets.. hard one! :)

    The name will appear only in column A of each 4 sheets, the range the name might appear is A1 to A8000, does it help?

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Finding how many times a name appear in 4 sheets.. hard one! :)

    since its only 4 sheets why not just =countif(sheet1!a1:a8000,"bobby")+countif(sheet2!a1:a8000,"bobby")+countif(sheet3!a1:a8000,"bobby")+countif(sheet4!a1:a8000,"bobby")
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  5. #5
    Forum Contributor
    Join Date
    10-28-2010
    Location
    quebec, canada
    MS-Off Ver
    o365
    Posts
    187

    Re: Finding how many times a name appear in 4 sheets.. hard one! :)

    I'm trying it right now, doesnt seem to work, let me tweak it a bit and change the names for the real ones and sheet name, shouldnt be a problem then.

  6. #6
    Valued Forum Contributor scottylad2's Avatar
    Join Date
    09-03-2010
    Location
    edinburgh
    MS-Off Ver
    Office 2007 Prof & Office 2010 Student Edition
    Posts
    629

    Re: Finding how many times a name appear in 4 sheets.. hard one! :)

    SUMPRODUCT(--(Sheet1!$A$1:$A$8000=Sheet1!C2)--(Sheet2!$A$1:$A$8000=Sheet1!C2)--(Sheet3!$A$1:$A$8000=Sheet1!C2)--(Sheet4!$A$1:$A$8000=Sheet1!C2)) where Sheet1!C2 has bobby in it
    Last edited by scottylad2; 11-02-2010 at 11:03 AM.

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Finding how many times a name appear in 4 sheets.. hard one! :)

    dont want to be picky but whats the point of using sumproduct when countif will do?
    and as it stands needs , between the arguments
    also this would only count where say bobby was in the same cell on all 4 sheets
    SUMPRODUCT(--($A$1:$A$1000=C2),--(Sheet2!$A$1:$A$1000=Sheet1!C2),--(Sheet3!$A$1:$A$1000=Sheet1!C2),--(Sheet4!$A$1:$A$1000=Sheet1!C2))
    Last edited by martindwilson; 11-02-2010 at 11:10 AM.

  8. #8
    Valued Forum Contributor scottylad2's Avatar
    Join Date
    09-03-2010
    Location
    edinburgh
    MS-Off Ver
    Office 2007 Prof & Office 2010 Student Edition
    Posts
    629

    Re: Finding how many times a name appear in 4 sheets.. hard one! :)

    just showing there's more than one solution, both will do. Some people prefer sumproduct for counting, although countif is probably better in terms of performance.

    The beauty of Excel, many ways to crack a nut

  9. #9
    Valued Forum Contributor scottylad2's Avatar
    Join Date
    09-03-2010
    Location
    edinburgh
    MS-Off Ver
    Office 2007 Prof & Office 2010 Student Edition
    Posts
    629

    Re: Finding how many times a name appear in 4 sheets.. hard one! :)

    Quote Originally Posted by martindwilson View Post

    also this would only count where say bobby was in the same cell on all 4 sheets
    The reference to Bobby is only in cell C1 sheet 1 for my example. he can be anywhere within the ranges of the sheets 1 to 4 in A1:A8000 range,Cell C1Sheet1 is mereley the criteria but it could also be replaced with the the name hardcoded into the formula if it is going to be the only name looked for but if there's more than one then i tend to try and keep the names out of the actual formula and refer to them in a cell

  10. #10
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Finding how many times a name appear in 4 sheets.. hard one! :)

    but there were no separators in the one you posted ! it wouldn't work! and as i said it wont count all instances of whats in c2 but only where say a5 on each sheet had the value of c2 in it so bobby in a5 of each sheet would count as 1 not 4, also if bobby was in only a100 of sheet 1 it wouldn't get counted at all. now that is possibly what the op wants but we don't know!
    ah i see what you're doing but the -- is not needed any way it just confused me! it looked incomplete
    =SUMPRODUCT(($A$1:$A$1000=C2)+(Sheet2!$A$1:$A$1000=Sheet1!C2)+(Sheet3!$A$1:$A$1000=Sheet1!C2)+(Sheet4!$A$1:$A$1000=Sheet1!C2)) serves the same purpose
    Last edited by martindwilson; 11-02-2010 at 11:32 AM.

  11. #11
    Forum Contributor
    Join Date
    10-28-2010
    Location
    quebec, canada
    MS-Off Ver
    o365
    Posts
    187

    Re: Finding how many times a name appear in 4 sheets.. hard one! :)

    Thank you very much everyone, it worked with the countif i never tried the sumproduct function, but i saved that in my note in case i might need it!!!

    I want to crank it another level...

    heres the real formula that worked:
    =COUNTIF('hdcore1 VBA'!A1:A8000;"Rancourt Marc-Olivier")+COUNTIF('hdcore2 VBA'!A1:A8000;"Rancourt Marc-Olivier")+COUNTIF('hdcore3 NON-VBA'!A1:A8000;"Rancourt Marc-Olivier")+COUNTIF('hdcore4 NON-VBA'!A1:A8000;"Rancourt Marc-Olivier")

    My sheets are called
    hdcore1 VBA
    hdcore2 VBA
    hdcore3 NON-VBA
    hdcore4 NON-VBA

    What if...

    now that i can count how many times this name appear in sheet 1 to 4, can i, each time excel find a name in column a1 to a8000, it will look at column E (same row as where the name was found), and if row E shows the word "valid" it will count +1 ?

    Tricky isnt it?

  12. #12
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Finding how many times a name appear in 4 sheets.. hard one! :)

    now you need sumproduct!

  13. #13
    Forum Contributor
    Join Date
    10-28-2010
    Location
    quebec, canada
    MS-Off Ver
    o365
    Posts
    187

    Re: Finding how many times a name appear in 4 sheets.. hard one! :)

    ahaha

    how can i use sumproduct then? i never used that function!

  14. #14
    Valued Forum Contributor scottylad2's Avatar
    Join Date
    09-03-2010
    Location
    edinburgh
    MS-Off Ver
    Office 2007 Prof & Office 2010 Student Edition
    Posts
    629

    Re: Finding how many times a name appear in 4 sheets.. hard one! :)

    Which version of Excel do you have? just for clarity, you only want the count now if both criteria are met?

    SUMPRODUCT(--($A$1:$A$8000="bobby"),--($E$1:$E$8000="valid"))+SUMPRODUCT(--(Sheet2!$A$1:$A$8000="bobby"),--(Sheet2!E1:E8000="valid")) etc through your 4 sheets.

    If you have Excel 2007 or later then Countifs would be the way to go

  15. #15
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Finding how many times a name appear in 4 sheets.. hard one! :)

    =SUMPRODUCT(--('hdcore1 VBA'!A1:A800=C2);--('hdcore1 VBA'!B1:B800="valid"))+SUMPRODUCT(--('hdcore2 VBA'!A1:A800=C2);--('hdcore2 VBA'!B1:B800="valid"))+SUMPRODUCT(--('hdcore3 NON-VBA'!A1:A800=C2);--('hdcore3 NON-VBA'!B1:B800="valid"))+SUMPRODUCT(--('hdcore4 NON-VBA'!A1:A800=C2);--('hdcore4 NON-VBA'!B1:B800="valid"))
    where c2 holds the name of interest

  16. #16
    Valued Forum Contributor scottylad2's Avatar
    Join Date
    09-03-2010
    Location
    edinburgh
    MS-Off Ver
    Office 2007 Prof & Office 2010 Student Edition
    Posts
    629

    Re: Finding how many times a name appear in 4 sheets.. hard one! :)

    For countifs

    COUNTIFS(Sheet1$A$1:$A$8000,"bobby",E1:E8000,"valid")+COUNTIFS(Sheet2!A1:A8000,"bobby",Sheet2!$E$1:$E$8000,"valid") etc through your 4 sheets.

    Remember your ranges need to be the same size for sumproduct

  17. #17
    Forum Contributor
    Join Date
    10-28-2010
    Location
    quebec, canada
    MS-Off Ver
    o365
    Posts
    187

    Re: Finding how many times a name appear in 4 sheets.. hard one! :)

    Sumproduct i got a "can't find in the library" issue, i probably need to install something for it to work.

    The countif seems to be logical, but can't make it work, let me tweak it a bit, i'll try to find out what doesnt work, i'll try it on a single sheet, if it works, i'll add the + for the other sheets.

    =COUNTIF(hdcore1 VBA$A$1:$A$8000,"Benoit Johanne",E1:E8000,"valid")

    this is a real example on a single sheet

    doesnt work!

  18. #18
    Valued Forum Contributor scottylad2's Avatar
    Join Date
    09-03-2010
    Location
    edinburgh
    MS-Off Ver
    Office 2007 Prof & Office 2010 Student Edition
    Posts
    629

    Re: Finding how many times a name appear in 4 sheets.. hard one! :)

    Sumproduct works in all versions i've used, can you upload a sample of your sheet? Again, which version of Excel are you using? if it's 2007 or later then countifs <<<< note the s on the end >>>> is probably the neatest way to go. The logic in sumproduct the way it's being suggested to you is doing the same as the countif but as you have more than one criteria it's doing the same as the countifs

  19. #19
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Finding how many times a name appear in 4 sheets.. hard one! :)

    its countifs not countif and will only work in excel 2007 or later
    the sum product works must be a typo as its availiable in all versions probably a sheet name or something
    Attached Files Attached Files

  20. #20
    Forum Contributor
    Join Date
    10-28-2010
    Location
    quebec, canada
    MS-Off Ver
    o365
    Posts
    187

    Re: Finding how many times a name appear in 4 sheets.. hard one! :)

    i'm on 2003, that might be why i have some error message
    Let me find out with somproduct, i i will also upload a sample of my sheet, let me just clear some info out, there is some private corporate info on those, i'll clear one out and will post it.

  21. #21
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Finding how many times a name appear in 4 sheets.. hard one! :)

    the one i uploaded is based on your sheet names

  22. #22
    Forum Contributor
    Join Date
    10-28-2010
    Location
    quebec, canada
    MS-Off Ver
    o365
    Posts
    187

    Re: Finding how many times a name appear in 4 sheets.. hard one! :)

    thanks to your sumproduct sheet !! it worked! i am very grateful to you guys, you saved me so many hours of work :D

    Thanks again!

+ 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