+ Reply to Thread
Results 1 to 4 of 4

Use output of condition for calculation

  1. #1
    Registered User
    Join Date
    09-18-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    35

    Smile Use output of condition for calculation

    I have a table with orders for stocking in an inventory, so the same product appears multiple times in the table, however possibly with different prices as time passes. I want to make calculations with the prices for a given period.

    I have a table with sold products, and a table with the purchases of raw materials for these products. I buy (more or less) the same raw materials every time, and I want to make a calculation in the products' table regarding the profit. There I need to sum up all the raw materials, but per material only the most recent purchase. So if I have bought Paper as raw material in 2010, and once more in 2012 (for a different price), I need to make the profit calculations for all my sold products since 2012 with the new Paper price. And obviously I have a lot of these raw materials.

    So I was thinking about this formula, but one that works in Excel: FOR(Sold_Products[Date]>Raw_Materials[Date],SUM([Raw_Materials[Price]))

    === OLD EXAMPLE ===
    See the example below:
    \1

    For example, I'd like to sum up all the prices before today's date. I was thinking about something like IF(TODAY()<B:B,SUM(C:C),"") but obviously the IF-statement is inappropriate here. A FOR-statement would be nice, but that doesn't exist in Excel.


    Thanks a lot in advance!
    Attached Images Attached Images
    Last edited by Stormbringer; 10-02-2013 at 08:53 AM. Reason: Provided a better example

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: Use output of condition for calculation

    There's not much point in posting a picture, but you might like to try this formula:

    =SUMIF(B:B,"<"&TODAY(),C:C)

    Hope this helps.

    Pete

  3. #3
    Forum Expert RobertMika's Avatar
    Join Date
    06-22-2009
    Location
    Haverhill, UK
    MS-Off Ver
    Excel 2003-13
    Posts
    1,530

    Re: Use output of condition for calculation

    Try Pivot Table.
    If you are http://www.excelforum.com/image.php?type=sigpic&userid=125481&dateline=1392355029happy with the results, please add to the contributor's
    reputation by clicking the reputation icon (star icon).




    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.
    To undo, select Thread Tools-> Mark thread as Unsolved.
    http://www.excelaris.co.uk

  4. #4
    Registered User
    Join Date
    09-18-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: Use output of condition for calculation

    Quote Originally Posted by Pete_UK View Post
    There's not much point in posting a picture, but you might like to try this formula:

    =SUMIF(B:B,"<"&TODAY(),C:C)

    Hope this helps.

    Pete
    Thanks Pete, that's a perfect solution for the example, but I'm looking for a more general solution. I'll update the first post in a bit to make it clear.

    Quote Originally Posted by RobertMika View Post
    Try Pivot Table.
    Thanks Robert, a Pivot Table would give the desired output, but I'm hoping to get the same output in a single cell to make calculations easier.

+ 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. Populate Output sheet based on input data and lookup condition
    By Cool\m/ in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-10-2013, 04:45 AM
  2. Replies: 3
    Last Post: 05-29-2013, 12:43 PM
  3. Extract from multiple worksheets based on one condition and output to new workbook
    By Lifeseeker in forum Excel Programming / VBA / Macros
    Replies: 33
    Last Post: 01-23-2012, 05:05 PM
  4. Need Help with Calculation of total hours with a positive output
    By mahri811 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-03-2011, 07:46 AM
  5. Output of a cell as the condition for a filter
    By scanavan in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-25-2007, 03:22 PM

Tags for this Thread

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