+ Reply to Thread
Results 1 to 8 of 8

Help using loops to count rows and return percentages

  1. #1
    Registered User
    Join Date
    08-13-2009
    Location
    Glasgow
    MS-Off Ver
    Excel 2016,2016,365
    Posts
    92

    Help using loops to count rows and return percentages

    Hello,

    Using loops is something that I would like to become better at doing. I tend to find what works and then paste again and change, names and columns. Problem is that am I not sure what is possible. So, asking you if this can be done.

    I have a sheet called DB Headcount, DB Starters, and one called Asst Mgt. Here is my code with takes the count of anything in DB Headcount, column u, "Asset Comms Eng", anything in DB Starters, column n, "Asset Comms Eng"

    Divides the two and gets a percentage and pastes into Asset Mgt, starting with cell B2.

    Is there a way to loop round and find the same for Asset Mgt, Asset Mgt HSE etc? Thanks Ross

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Help using loops to count rows and return percentages

    Can you attach a short Excel sample, it will help to debug.
    - Battle without fear gives no glory - Just try

  3. #3
    Registered User
    Join Date
    08-13-2009
    Location
    Glasgow
    MS-Off Ver
    Excel 2016,2016,365
    Posts
    92

    Re: Help using loops to count rows and return percentages

    Hello,

    File attached. Hopefully it makes sense.

    Thanks
    Ross
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Help using loops to count rows and return percentages

    Without values it is not so easy to prepare macro, nevertheless try next code: NOT TESTED
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-13-2009
    Location
    Glasgow
    MS-Off Ver
    Excel 2016,2016,365
    Posts
    92

    Re: Help using loops to count rows and return percentages

    Works great. I have a small issue which is that if I use this code for another sheet, say one called Thermal, I have Business Dev in that range too so it picks that also. So if i have a starter in Asset Mgt(column M) in the starters sheet and falls in Business Dev(column N) when I run your code in say the sheet for Thermal it picks up the starter that is in Asset Mgt - Business Dev. Is there way to say If Column M equals Asset Mgt and Column N equals Business Dev pick that one, and then for thermal it would be IF Column M equals Thermal and Column N equals Business Dev pick that one.

  6. #6
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Help using loops to count rows and return percentages

    Please attach a new file with issue you are speaking about
    Column M is in which sheet??

  7. #7
    Registered User
    Join Date
    08-13-2009
    Location
    Glasgow
    MS-Off Ver
    Excel 2016,2016,365
    Posts
    92

    Re: Help using loops to count rows and return percentages

    It's in the Starters Tab. I have added a couple of entries so you get the idea so it should only count the Business Dev that is next to Asset Mgt not Thermal.

    Thanks

    Ross
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Help using loops to count rows and return percentages

    I do not see any difference with previous file ...!

+ 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] Count the members of a list to determine how many copy loops to run in another worksheet
    By Cbird in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-25-2017, 06:19 PM
  2. [SOLVED] Loop Macro needs to return blanks in cell for segments that are not found between loops
    By LeeXCEL in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2017, 07:33 PM
  3. Nested Loops due to multiple rows with same ID
    By t3chg1rl in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-14-2016, 04:25 PM
  4. [SOLVED] Not getting an actuate count of particular numbers/percentages
    By khank in forum Excel General
    Replies: 3
    Last Post: 09-25-2012, 09:53 AM
  5. Loops through rows to create new sheet
    By missf in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-31-2011, 11:05 AM
  6. count for percentages
    By maryj in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-13-2005, 11:06 AM
  7. [SOLVED] loops and count
    By G in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-14-2005, 05:06 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