+ Reply to Thread
Results 1 to 3 of 3

Suming with criteria in cronilogical order

  1. #1
    Registered User
    Join Date
    North Carolina, USA
    MS-Off Ver
    Excel 2010

    Suming with criteria in cronilogical order

    Please help.

    I'm trying to work this out and can't figure it out. I would like a formula that i can drag down the "Current Holdings and Gain/loss" Columns that will give the following results....

    Date Name Type Quantity Price Current Holdings Gain/Loss
    1/1/2001 Stock a Initial 1000 1 1000 0
    1/2/2001 Stock a Sell 100 2 900 100
    1/3/2001 Stock a Buy 100 2.5 1000
    1/4/2001 Stock a Sell 200 2 800 50loss+ 100Gain
    1/5/2001 Stock a Sell 800 2 600 800
    1/1/2001 Stock b Initial 1000 1000
    1/2/2001 Stock b Buy 200 1200
    1/3/2001 Stock b Sell 150 1050
    1/4/2001 Stock b Buy 150 1200


  2. #2
    Valued Forum Contributor
    Join Date
    Eastbourne, England
    MS-Off Ver
    Excel 2010

    Re: Suming with criteria in cronilogical order

    Hi exclusiveicon

    I was going to say that you cannot get a formula to do this, but then I thought that was a very arrogant thought, so let me say that I do not know how to write such a formula.

    I'm not sure whether you realise, but you are asking for a LIFO system (Last in First Out) and this is (for me) the incredibly complicated bit. I could write some VBA to handle it, but not a formula.

    If you are prepared to accept an average system (whereby the selling price is compared to the average price of the stock), I have written some formulas that will do the job. (Note that it is important to have a blank row between each type of stock)

    Let me know how you get on

    Attached Files Attached Files

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    Duncansville, PA USA
    MS-Off Ver
    Excel 2000/3/7/10/13/16

    Re: Suming with criteria in cronilogical order

    To best describe or illustrate your problem you would be better off attaching a dummy workbook. The workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you


+ 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. Sum by criteria in order to multiply
    By The student in forum Excel General
    Replies: 3
    Last Post: 06-08-2012, 08:16 PM
  2. Suming across a row using criteria
    By stoneglobe in forum Excel General
    Replies: 3
    Last Post: 10-29-2009, 11:04 AM
  3. Suming selected cells based on two criteria
    By Gerard in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-09-2006, 06:49 AM
  4. unique order number according to criteria
    By ellebelle in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-03-2006, 07:35 AM
  5. Suming using 2 criteria
    By Hall in forum Excel General
    Replies: 1
    Last Post: 05-27-2005, 03:05 PM

Tags for this Thread


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