+ Reply to Thread
Results 1 to 8 of 8

Macro to check total quantities

  1. #1
    Registered User
    Join Date
    07-08-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    51

    Macro to check total quantities

    I have a spreadsheet that tracks what we buy, when we buy it, when it comes in and how much it cost.

    If we order a part and we get a partial quantity we record only the partial receipt. I need a macro that looks at the total quantity ordered, then looks for any receipts on that same PO and totals all of the quantities received.

    If everything has been received then I want a new column to show "1". if there is still an outstanding balance I would like a "2". I have attached a mock up of what some of my data looks like and what I am trying to accomplish.


    Thanks in advance. Purchase Order Sample.xlsx

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to check total quantities

    Perhaps this formula included in an empty column, say J2, then copied down.

    =IF(SUMIF(I:I,I2,E:E)=A2, 1, 2)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    07-08-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    51

    Re: Macro to check total quantities

    That did not work. I am getting a 2 for all entries.

    The first four lines in total should eqaul 24. each line is not expecting a total of 24.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to check total quantities

    So, what would the expected answers be in J2:J5 then?

  5. #5
    Registered User
    Join Date
    07-08-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    51

    Re: Macro to check total quantities

    In J2 through J5 should read 2. The other item should have a 1 because not all 48 have been received

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to check total quantities

    Quote Originally Posted by bremen22 View Post
    if there is still an outstanding balance I would like a "2".
    Neither of your groups in the sample workbook have received all their items, so all items result in 2. The first group has received 23 out of 24, the second group has received 39.7 out of 48. The formula is correct.

  7. #7
    Registered User
    Join Date
    07-08-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    51

    Re: Macro to check total quantities

    My applogies. I didnt realize my error there.

    The formula does work as it should when plugged into my actual data set.

    Thank you so much.


    However, I have a small problem and I just cant work out the logic.......

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to check total quantities

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


    New problems.... new threads.

+ 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. Finding total quantities in multiple lines of data
    By robbo46 in forum Excel General
    Replies: 1
    Last Post: 01-06-2012, 12:13 PM
  2. Highlighting low quantities from Total
    By euwest30 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-18-2008, 07:28 PM
  3. [SOLVED] Macro to calculate total quantities
    By DanPtWash in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-18-2005, 12:35 PM
  4. [SOLVED] RE: Macro to calculate total quantities
    By Gary''s Student in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-18-2005, 12:30 PM
  5. [SOLVED] Finding duplicate entries with matching lengths, total the quantities, delete the extras
    By RShow in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-03-2005, 06:05 AM

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