+ Reply to Thread
Results 1 to 16 of 16

Recipe and product cost calculation help needed

  1. #1
    Registered User
    Join Date
    12-27-2020
    Location
    Turkey
    MS-Off Ver
    365
    Posts
    4

    Recipe and product cost calculation help needed

    Hello I need help with calculating price of a products from recipe list.
    Screenshot_2.png

    I have much bigger table with prices and recipes. I made a recursive macro to find prices of all but it works really slow and i need to improve it.
    Do you know a way to find prices of given product from recipe and cost of recipe?
    Thank you.

    Recipe Cost.xlsx

  2. #2
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105

    Re: Recipe and product cost calculation help needed

    Hi,
    Fast answers need clear examples. Post a small Excel sheet (not a picture) showing realistic & representative sample data WITHOUT confidential information (10-20 rows, not thousands...) and some manually calculated results. Just before posting, scroll down to GO ADVANCED, click, and then scroll down to MANAGE ATTACHMENTS and click again. Now follow the instructions at the top of that screen.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,900

    Re: Recipe and product cost calculation help needed

    There is a workbook attached at the bottom of the opening post ...
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Valued Forum Contributor
    Join Date
    04-27-2015
    Location
    Abu Dhabi, U.A.E
    MS-Off Ver
    Office 365 | 2016
    Posts
    696

    Re: Recipe and product cost calculation help needed

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105

    Re: Recipe and product cost calculation help needed

    Thanks Ali,

    tugkan98 - what should the answer be in your example?

  6. #6
    Registered User
    Join Date
    12-27-2020
    Location
    Turkey
    MS-Off Ver
    365
    Posts
    4

    Re: Recipe and product cost calculation help needed

    Answer is 19.465
    Shareez's solution gives 3.1 as result

  7. #7
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105

    Re: Recipe and product cost calculation help needed

    please explain why 19.465

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,900

    Re: Recipe and product cost calculation help needed

    I get 13.654 with this raw calculation; =2*C8+1*D14+1*Table5[@[used_amount]]+3*D12+3*D13

    Is this the calculation you are wanting? If so, we can find a neat way of doing it.

    No, wait - I think I get what you want, but I have to say, i don't think your chosen layout makes much sense.

    Is this the raw calculation?

    =2*C8+(1*D14*C6)+(1*Table5[@[used_amount]]*C7)+(3*D12*C4)+(3*D13*C5)
    Last edited by AliGW; 12-27-2020 at 10:49 AM.

  9. #9
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Recipe and product cost calculation help needed

    A single table approach.
    Each recipe with individual ingredients.
    The table is elastic, add another recipe to right hand column.
    torchan
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    08-26-2016
    Location
    UK
    MS-Off Ver
    O365
    Posts
    260

    Re: Recipe and product cost calculation help needed

    I get 19.46 too, see cell F19 in the attached.
    Now to try and figure how to get it more simply.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    12-27-2020
    Location
    Turkey
    MS-Off Ver
    365
    Posts
    4

    Re: Recipe and product cost calculation help needed

    Screenshot_1.png

    It is says its a link you cant post it so i share a screenshot

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,900

    Re: Recipe and product cost calculation help needed

    See post #9.

  13. #13
    Forum Contributor
    Join Date
    08-26-2016
    Location
    UK
    MS-Off Ver
    O365
    Posts
    260

    Re: Recipe and product cost calculation help needed

    In the attached is a result table (pivot) at cell B25. Change values in either of the other 2 tables then right-click the reusult table and choose Refresh to update the result.
    At the moment, because what's in the 2nd column of your table at cell B11 only needs to be looked up in the first column once (1 level of recursion) it works; if the lookup can happen more than once it will need a tweak.
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    12-27-2020
    Location
    Turkey
    MS-Off Ver
    365
    Posts
    4

    Re: Recipe and product cost calculation help needed

    Is there a formula which does recursion to the end of the node whatever the level of recursion is?
    I wrote a working macro using recursive function but it took really long time because excel works slow and I wrote bad code.
    Last edited by AliGW; 12-30-2020 at 03:04 AM. Reason: PLEASE don't quote unnecessarily!

  15. #15
    Forum Contributor
    Join Date
    08-26-2016
    Location
    UK
    MS-Off Ver
    O365
    Posts
    260

    Re: Recipe and product cost calculation help needed

    I'm sure it (Power Query) can but I have never tried to do it (yet).
    Last edited by AliGW; 12-30-2020 at 03:04 AM. Reason: PLEASE don't quote unnecessarily!

  16. #16
    Registered User
    Join Date
    12-03-2020
    Location
    Bangkok,Thailand
    MS-Off Ver
    365
    Posts
    29

    Re: Recipe and product cost calculation help needed

    Try this at "FIND PRICE?"

    =SUMPRODUCT(MMULT(--IF(IF(Table5[main_code]=[code],Table5[used_code],"")=TRANSPOSE(Table4[code]),TRANSPOSE(Table4[price])),SEQUENCE(COUNTA(Table4[code]),1,1,0)),IF(Table5[main_code]=[code],Table5[used_amount]))+SUM(MMULT(--(IF(IF(MMULT(IFERROR(FIND(Table5[main_code],TRANSPOSE(IF(Table5[main_code]=[code],Table5[used_code]))),0)*TRANSPOSE(Table5[used_amount]),SEQUENCE(COUNTA(Table5[main_code]),1,1,0)),Table5[used_code])=TRANSPOSE(Table4[code]),TRANSPOSE(Table4[price]))),SEQUENCE(COUNTA(Table4[code]),1,1,0))*MMULT(IFERROR(FIND(Table5[main_code],TRANSPOSE(IF(Table5[main_code]=[code],Table5[used_code]))),0)*TRANSPOSE(Table5[used_amount]),SEQUENCE(COUNTA(Table5[main_code]),1,1,0))*Table5[used_amount])

+ 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. Output Txt file with recipe based on variable recipe entered into excel sheet
    By sdl2 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-21-2019, 08:35 PM
  2. Recipe Cost Form with Conversions and Drop Down Menu
    By Dracoko4757 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-28-2019, 12:27 AM
  3. Solution for iterative calculation of result for 3 variable product cost.
    By almashasnain in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-30-2018, 02:36 PM
  4. Replies: 1
    Last Post: 03-17-2017, 04:17 AM
  5. Replies: 1
    Last Post: 04-24-2015, 09:46 AM
  6. Replies: 2
    Last Post: 10-03-2014, 07:39 PM
  7. Cost Driver calculation - Looking for formula/macro to calculate manpower cost alloca
    By Swastik Banerje in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-30-2009, 11:18 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