+ Reply to Thread
Results 1 to 35 of 35

Help to count cells on sheets with changing names

  1. #1
    Registered User
    Join Date
    10-23-2019
    Location
    OHIO
    MS-Off Ver
    office 2013
    Posts
    84

    Cool Help to count cells on sheets with changing names

    Hi All,

    I am using a formula to count how many times a name appears in an individual sheet using:

    =COUNTIF('2209'!H1:H50,"A Name")*12

    which is placed on a seperate sheet and then timsing it by 12 as the staff member works 12 hours.....


    This works well but a new sheet is created weekly (time sheets for staff) with the name of the sheet being the date of the last working day of that week IE: sheet name: 2710 would be the sheet name so i would know that specific weeks ends on that date.

    what i want to do is be able to get the formula to autoupdate every time i create a new sheet so when 2710 becomes 0311 the fomula will change automatically from =COUNTIF('2710'!H1:H50,"A Name")*12 to =COUNTIF('0311'!H1:H50,"A Name")*12


    I tried adding a date box at G2 so i could just type in say 0311 so i tried changing the formula to =COUNTIF('=G2'!H1:H50,"A Name")*12 so it would add the content of g2 and in turn reference that sheet name but i had no luck with this.

    Can anyone suggest a way to make this work? apologies as you can tell i am a noob so make it idiot friendly please lol

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474

    Re: Help to count cells on sheets with changing names

    If you have the worksheet name in G2 then try this out.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-23-2019
    Location
    OHIO
    MS-Off Ver
    office 2013
    Posts
    84

    Re: Help to count cells on sheets with changing names

    Hi Dave,

    Thanks for the quick response, i guess i should have worded it better mate, my bad! lol


    g2 is a cell not a sheet which i thought about writing the name of the actual sheet hoping that adding =g2 would change the figure in the formula to what ever was in the shell g2 and then in turn that would reference the sheet name that was typed into g2.....

    i love making things complicated lol
    Last edited by JON_ROCKS; 10-23-2019 at 09:10 AM.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,891

    Re: Help to count cells on sheets with changing names

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? However, please give us an indication of the approximate number of rows of data you want the solution to work with (100, 1000, 100,000 or whatever). Please DO NOT attach a picture of an Excel sheet (I do not have the patience to re-type any/all your stuff before starting).

    1. It does NOT have to be your real sheet - mock up a SAMPLE if you need to. But not 1000's of rows!!! It makes manual checking so tedious. Whatever you do... make sure that all confidential information is removed first!!

    2. Make sure that your sample data are truly REPRESENTATIVE of your real data. For example, don't show text in a column if it's really a number. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    3. Make sure that your desired solution is also shown (mock up the results manually). To be honest, I am not interested in seeing a non-working formula... or a pile of blank cells. However, I am very interested in seeing your EXPECTED results in their EXPECTED location.

    4. Try not to use merged cells. They cause lots of problems and are DEFINITELY best avoided!

    Unfortunately the attachment icon doesn't work at the moment. So,... instead click on Go Advanced (below the Edit Window) while composing your reply, then scroll down to and click on Manage Attachments and the Upload window will open. Click on Browse and navigate to (and double-click) the file icon that you want to attach, then click on Upload and then on Close this Window to return to the Edit window. When you have finished composing your post, click on Submit Post.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  5. #5
    Registered User
    Join Date
    10-23-2019
    Location
    OHIO
    MS-Off Ver
    office 2013
    Posts
    84

    Re: Help to count cells on sheets with changing names

    Not a problem , i have attached a shortened example below of what we currently use:

    tinyurl.com/exsheet100

    Please excuse any mistakes as i had to chop it to pieces to cut it down
    Last edited by JON_ROCKS; 10-23-2019 at 09:13 AM.

  6. #6
    Registered User
    Join Date
    10-23-2019
    Location
    OHIO
    MS-Off Ver
    office 2013
    Posts
    84

    Re: Help to count cells on sheets with changing names

    hmm i take it back i miss read your reply dave, this at first glance works fine


    Thanks for the help!!

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,891

    Re: Help to count cells on sheets with changing names

    I suspect it might be more complicated than this.... but we'll see.

    =COUNTIF(INDIRECT("'"&TEXT($G$2,"0000")&"'!"&CELL("address",B$1)&":"&CELL("address",B$200)),$A5)*10

    for some unknown reason, the data on 0311 start way down the sheet... The dates between sheets don't tally. that's why I think this is not correct yet.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    10-23-2019
    Location
    OHIO
    MS-Off Ver
    office 2013
    Posts
    84

    Re: Help to count cells on sheets with changing names

    Hi Glen,

    Yea sorry i deleted a lot of data and realised i hadnt moved things up lol

    Dave,

    Your formula works wonders but is there a way to change the "A Name"

    =COUNTIF(INDIRECT("'" & $G$2 & "'!" & "B46:B47"),"A Name")*10

    to automatically match the name in the cell say a1? the reason i ask is if i change the name in the names section tothe left i want the formula to update that section but changing the formula to

    =COUNTIF(INDIRECT("'" & $G$2 & "'!" & "B46:B47")," & A1 & ")*10

    didnt seem to work?

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,891

    Re: Help to count cells on sheets with changing names

    Look at the formula:

    =COUNTIF(INDIRECT("'"&TEXT($G$2,"0000")&"'!"&CELL("address",B$1)&":"&CELL("address",B$200)),$A5)*10

    It is picking up the name from whatever is in A5. Change A5 to Donald Trump and it will search for values relating to him...

  10. #10
    Registered User
    Join Date
    10-23-2019
    Location
    OHIO
    MS-Off Ver
    office 2013
    Posts
    84

    Re: Help to count cells on sheets with changing names

    Hi Glenn

    Thanks for the help, but i cant seem to get your formula to work i pasted it into the top bar and it just fills the cell with your formula...what am i doing wrong?

    =COUNTIF(INDIRECT("'"&TEXT($G$2,"0000")&"'!"&CELL("address",B$1)&":"&CELL("address",B$200)),$A5)*10

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,891

    Re: Help to count cells on sheets with changing names

    If I can't see the problem, I can't diagnose the problem. Post a sample sheet.

  12. #12
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,891

    Re: Help to count cells on sheets with changing names

    Is the cell formatted as text? If so, format as general and try again.

  13. #13
    Registered User
    Join Date
    10-23-2019
    Location
    OHIO
    MS-Off Ver
    office 2013
    Posts
    84

    Re: Help to count cells on sheets with changing names

    rookie mistake, lol sorted now!

  14. #14
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,891

    Re: Help to count cells on sheets with changing names

    RoFLAO!!!

    We all do it....

  15. #15
    Registered User
    Join Date
    10-23-2019
    Location
    OHIO
    MS-Off Ver
    office 2013
    Posts
    84

    Re: Help to count cells on sheets with changing names

    Lol, you know we actually employ someone to transfer the numbers from the rota to these timesheets... you may have just made them unemployed! :D

    Thanks for all your help, this works ace! one last thing , is there a way to make the names it references to in $A68 less accurate? people have a tendency of writing on the rota D jones or Dave Jones etc... can it be made to pick up part of a name even if it is put differently on the rota? like just pick up the "jones"

    =COUNTIF(INDIRECT("'"&TEXT($G$2,"0000")&"'!"&CELL("address",B$105)&":"&CELL("address",B$106)),$A68)*10

    if not dont worry you have been an amazing help so far and im sure this page alone will greatly benefit people like me trying to make a working time sheet!

  16. #16
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,891

    Re: Help to count cells on sheets with changing names

    Back in an hour... or so.

  17. #17
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,891

    Re: Help to count cells on sheets with changing names

    That may lead to inaccuracies. Don't go there. Instead, do this:

    Create a list of staff. I put it on sheet Staff. Use this formula:

    =Staff!$A$1:INDEX(Staff!$A:$A,MATCH("Zzzz",Staff!$A:$A))

    to set up a Named Range ("Staff", CTRL-F3 to view edit).

    Set up ONE standard template sheet (e.g. 2209). Use data/data validation/List and =Staff in the source box and OK. Now only staff member's correct spelling can be entered. Work up the template to the exact spec you want and then create n copies. On the Tab name, right click/move or copy/create a copy.
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    10-23-2019
    Location
    OHIO
    MS-Off Ver
    office 2013
    Posts
    84

    Re: Help to count cells on sheets with changing names

    EXCELLENT! I will give it a go

    Thanks for all youre help Glen!
    Last edited by JON_ROCKS; 10-24-2019 at 09:05 AM.

  19. #19
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,891

    Re: Help to count cells on sheets with changing names

    I would usually create the perfect specimen, call it "template", copy it n times as required, and then hide it to prevent someone else's fat fingers mashing it up....

  20. #20
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,891

    Re: Help to count cells on sheets with changing names

    Before you go too far with this.... Is there a nice additional minefield that we still have to cross...

    Your individual raw data sheets have several sites on each one. Currently 2209 has 5.

    Your summary sheet, I have just notices, has a very worrying merged cell in A1 "site name". Does this mean that you will be wanting to pull data ONLY for "Site 1" (or whatever...) from sheet 2209, or data from all sites from sheet 2209???

    This could be about to get more complicated.

  21. #21
    Registered User
    Join Date
    10-23-2019
    Location
    OHIO
    MS-Off Ver
    office 2013
    Posts
    84

    Re: Help to count cells on sheets with changing names

    ahhh yes but i thought about this so instead of a generic coverage i have tailored your code a little to work out individual sites and thus created individual time sheets for each site.

    My biggest worry is if someone inserts a line somewhere in the rota and it throws out the whole sheet... think what i will do is selectively lock the rota sheets and prevent them doing this....

    The only other issue is if there is a miss type of a name or someone just writes jones instead of A Jones and some poor bugger doesnt get payed lol!

    Still the sheets will be checked against the rotas for mnow manually as i work on the little issues!

    I cant thank you enough for all your amazing help mate!

  22. #22
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,891

    Re: Help to count cells on sheets with changing names

    Righteo. The DV thing at post 18 will prevent mis-spelling.

    Have fun!!

  23. #23
    Registered User
    Join Date
    10-23-2019
    Location
    OHIO
    MS-Off Ver
    office 2013
    Posts
    84

    Re: Help to count cells on sheets with changing names

    This is an example mate of a snippet of the sheets:

    https://tinyurl.com/glen998

    Let me know what you think as your input has been invaluable
    Last edited by JON_ROCKS; 10-24-2019 at 09:28 AM.

  24. #24
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,891

    Re: Help to count cells on sheets with changing names

    No attachment attached!!

  25. #25
    Registered User
    Join Date
    10-23-2019
    Location
    OHIO
    MS-Off Ver
    office 2013
    Posts
    84

    Re: Help to count cells on sheets with changing names

    had to change it site wouldnt let me post the file for some reason.... tiny url'd it

    https://tinyurl.com/glen998

  26. #26
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,891

    Re: Help to count cells on sheets with changing names

    No.... In some places you have one row of data... in other places you have 3. Is it ALWAYS going to be EXACTLY the same on each each sheet? If not, it will be impossible to manage. Set up the sheet as I did, with a standardised number of rows per site/block whatever they are. then ONE template sheet will do for ALL scenarios.

  27. #27
    Registered User
    Join Date
    10-23-2019
    Location
    OHIO
    MS-Off Ver
    office 2013
    Posts
    84

    Re: Help to count cells on sheets with changing names

    the sheet , in theory..... should never change, only the names in it, to ensure this i intend to lock down the sheet so only name cells can be editied along with the sheet name and weekend cell... this way everything should auto update and as new sites etc are added or removed it shouldnt effect the way the sheet works....

    im almost completely new to this sort of thing so i am quite proud of what we have established so far...

    so in theory as i said this is how it should work....

    "Blank Rota" will be copied and pasted as a new sheet weekly... at the end of the week the "Time Sheets" page will have the "Week Ending" & " Sheet Name" boxes changed.... this so far autopopulates perfectly.

    Like i said the main thing is people adding or removing rows and throwing the structure out so if i protect the work book and leave only select unlocked cells, edit objects and edit scenarios i should be good.....

  28. #28
    Registered User
    Join Date
    10-23-2019
    Location
    OHIO
    MS-Off Ver
    office 2013
    Posts
    84

    Re: Help to count cells on sheets with changing names

    i do like the example sheet you did , which as you say would stop miss spelling but staff turn over is huge with us so it would be a case of changing these on sometimes a weekly basis otherwise thats definately the way i would go mate

  29. #29
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,339

    Re: Help to count cells on sheets with changing names

    Who is Miss Spelling?

    Sorry - couldn't resist ...

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  30. #30
    Registered User
    Join Date
    10-23-2019
    Location
    OHIO
    MS-Off Ver
    office 2013
    Posts
    84

    Re: Help to count cells on sheets with changing names

    Hi Glen,

    I have now adapted the workbook completely with the code you made for me, timesheets now use a name from a reference sheet so names can not be spelled incorrectly and everything works sooo much better!!

    I am now adapting the below into a module to use a button, it works...ok , but the issue i have is i only want to send the timesheet its self not the entire workbook. the below does this but without the specific data from other spreadsheets that the time sheet references from it all cells turn to 'REF'
    I have found if i save the document as a PDF first in excel it saves correctly so my question is this:

    Can something be added to the below code so the specific timesheet tab in the work book is first saved to a PDF file and then attached to an email at the press of a button?



    Please Login or Register  to view this content.

  31. #31
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,891

    Re: Help to count cells on sheets with changing names

    Shudder.... don't ask me about VBA. I don't use it.

    best to close this thread and open a new one with the new issue.

  32. #32
    Registered User
    Join Date
    10-23-2019
    Location
    OHIO
    MS-Off Ver
    office 2013
    Posts
    84

    Re: Help to count cells on sheets with changing names

    Haha no problem, will do mate

  33. #33
    Registered User
    Join Date
    10-23-2019
    Location
    OHIO
    MS-Off Ver
    office 2013
    Posts
    84

    Re: Help to count cells on sheets with changing names

    Hi Glenn, managed to sort out the VBA but as you said it got real complicated real fast lol!

    This spreadsheet is growing arms and legs and is turning out better than i could have imagined,

    I am now rounding it up and was wondering if you knew a way to make a cell auto populate a specific date from a specific spreadsheets cell?

    I am hoping it will be a similar formula to what you made to reference names from another page:

    =COUNTIF(INDIRECT("'"&TEXT($G$2,"0000")&"'!"&CELL("address",G$41)&":"&CELL("address",G$42)),$A160)*12

    the cell on each sheet is in the same place with the date E1.

    I really appreciate all your help so far.

  34. #34
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,339

    Re: Help to count cells on sheets with changing names

    Answers to the new thread started here, please: https://www.excelforum.com/excel-gen...her-sheet.html

  35. #35
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,339

    Re: Help to count cells on sheets with changing names

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Click/drag a formula pulling from differ sheets w/ excel auto changing sheet names only
    By GonzCilla in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-20-2018, 02:16 PM
  2. [SOLVED] VBA to create separate sheet with sheets names and count
    By Tyso in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-23-2018, 03:53 PM
  3. [SOLVED] How to Activate Sheets with Changing Names
    By phelbin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-26-2016, 08:02 PM
  4. Formula to look at sheets with changing names
    By satkin2 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-18-2015, 08:55 AM
  5. VBA - Copy cells from changing sheet names
    By acct404 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-02-2012, 03:38 PM
  6. Replies: 3
    Last Post: 02-11-2012, 08:34 AM
  7. [SOLVED] Changing File Names and Linking Cells between workbooks
    By James in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-18-2005, 08:45 PM

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