+ Reply to Thread
Results 1 to 9 of 9

Counting one column to feed another

  1. #1
    Registered User
    Join Date
    04-04-2017
    Location
    Zionsville, Indiana
    MS-Off Ver
    Office 2016
    Posts
    4

    Counting one column to feed another

    Hello I'm new to the forum but have a problem in excel. I work at a fab shop with a lot of orders and different parts needing to be scheduled all the time. I use excel to track and organize the whole process but want to automate a column of part numbers into another column that list how many of each part is contained in the first column.

    Excel Count Column.jpg

    As shown in the picture, it needs to scan one entire column, count how many of each like numbers there are and feed that to another column of parts and quantities. Does anybody know how to do this in a Macro or formula? Or any suggestions on how I might accomplish such a task?
    Attached Images Attached Images
    Last edited by BrianHull; 04-05-2017 at 09:30 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: Counting one column to feed another

    The formula you need is the countif function. In I3 the formula would be:
    =COUNTIF(B:B,H3)
    And just copy that down for the parts in column H.

    In order to auto-sort by the largest quantity as the count changes, you'll need some VBA. Put the following code in the Worksheet object where you data is and that should do it.
    Please Login or Register  to view this content.
    Hope that helps. MM.
    MatrixMan.
    --------------------------------------
    If this - or any - reply helps you, remember to say thanks by clicking on *Add Reputation.
    If your issue is now resolved, remember to mark as solved - click Thread Tools at top right of thread.

  3. #3
    Registered User
    Join Date
    04-04-2017
    Location
    Zionsville, Indiana
    MS-Off Ver
    Office 2016
    Posts
    4

    Re: Counting one column to feed another

    Thanks MM! That did count the column beautifully.

    Is there a way to get part list column H to auto generate. That is, can it count the items in column B and place them by the count without me copying numbers for H? The part column B will be always changing with new numbers being added and subtracted. I was hopeful that the formula could just count and place the items in column H automatically. Preferably according to largest quantities.

  4. #4
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: Counting one column to feed another

    Hi Brian - yes, this can be done ... I'll need to code it and I should have it ready shortly.

  5. #5
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: Counting one column to feed another

    Replace the previous code with the below and that should do it.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-04-2017
    Location
    Zionsville, Indiana
    MS-Off Ver
    Office 2016
    Posts
    4

    Re: Counting one column to feed another

    Alright I might need a little help to get this code entered correctly. I am new at coding with Excel.

    Here is what I did:

    Pulled up the Excel file
    Clicked on Developer tab and View Code
    Coding screen pops up
    I select the VBA project and sheet1 and paste the code you gave me
    I close out of VBA
    Go to view Macros but nothing is there to run?

    I think I'm missing a step or two. Does this sound right?

  7. #7
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: Counting one column to feed another

    You may not have actually pasted it where you think you did ... try double-clicking on the Sheet1 object and then paste.

  8. #8
    Registered User
    Join Date
    04-04-2017
    Location
    Zionsville, Indiana
    MS-Off Ver
    Office 2016
    Posts
    4

    Re: Counting one column to feed another

    The following error pops up and I don't believe it is allowing me to save the code. I did not create a macro but I did enable the macros and re-saved as a Macro enabled worksheet. I double clicked on sheet1 object and code was there. Do I need to create a macro to run with this code?

    VBA error.png

  9. #9
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: Counting one column to feed another

    Hi Brian. In the top left corner of the screen shot, you'll see it has the file name: "Example count file.xlsx". The xlsx extension is not a macro-enabled workbook. You need to save it with an xlsm file extension.

+ 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] Help in counting D if column a is x and column b is y, count column c with a price of XXX
    By grlnexdor in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-18-2013, 02:03 AM
  2. Replies: 4
    Last Post: 04-25-2013, 03:53 AM
  3. [SOLVED] Counting Multiple Values in a column based on critera in seperate column
    By ERoberts in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-11-2013, 01:08 PM
  4. Replies: 7
    Last Post: 03-12-2012, 11:32 PM
  5. Replies: 2
    Last Post: 01-04-2012, 10:22 AM
  6. feed data from one sheet to another based on criteria in one column
    By mbowles12 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-24-2009, 11:44 AM
  7. Counting cells in offset column based on contents of another column.
    By Big Chris in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-10-2008, 09:25 AM
  8. Parsing Excel Column based on Line Feed/Carriage Return?
    By kj2398 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-08-2007, 01:23 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