+ Reply to Thread
Results 1 to 15 of 15

sum with if and multiply together

Hybrid View

  1. #1
    Registered User
    Join Date
    01-06-2016
    Location
    turkey
    MS-Off Ver
    office 2015
    Posts
    8

    sum with if and multiply together

    Hello,

    I want to use a formula to create a statistical result for scrap analysis. I dont believe I can explain my necessity with words here, so please see the attachment that I explained what I need with partial analysis of my original file.

    I will be very glad if anyone can help me.

    Regards
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor PeteABC123's Avatar
    Join Date
    09-21-2012
    Location
    Chicago, IL
    MS-Off Ver
    MS Office 365 ver 2202
    Posts
    1,104

    Re: sum with if and multiply together

    You need to fix your commas/periods in what appears to be a percentage to multiply by. Not sure what you're trying to do. Could you post an expected result and how it's ultimately achieved?
    Pete

  3. #3
    Registered User
    Join Date
    01-06-2016
    Location
    turkey
    MS-Off Ver
    office 2015
    Posts
    8

    Re: sum with if and multiply together

    for example;

    in the file, for the code "5500020" I have 50 kg scrap. If I divide this amount, I will have;
    1980000: 50*21,36% = 10,68 kg (I need to see in L5 10,68+18 = 28,68 kg)
    6400200: 50*32,45% = 16,225 kg
    1952010: 50*25,12% = 12,56 kg (I need to see in L7 12,56+19 = 31,56 kg)
    1980010: 50*21,07% = 10,535 kg


    I need a formula to see these results in one cell. Thank you.

  4. #4
    Valued Forum Contributor PeteABC123's Avatar
    Join Date
    09-21-2012
    Location
    Chicago, IL
    MS-Off Ver
    MS Office 365 ver 2202
    Posts
    1,104

    Re: sum with if and multiply together

    ngngc:
    Try this in L5 and copy up and down.
    Formula: copy to clipboard
    =SUM($G$4*E5)+SUMIFS(G$4:G$20,$D$4:$D$20,$K5)

    Adjust $G$4 as appropriate. let us know if it works.
    Pete

  5. #5
    Registered User
    Join Date
    01-06-2016
    Location
    turkey
    MS-Off Ver
    office 2015
    Posts
    8

    Re: sum with if and multiply together

    Thank you for your effort and help, this formula helped me for this example but it seems that I should prepare this example more complicated because as "5500020", we have many codes and with this function I will need to identify each code everytime. please see attached file, this time I hope everything will be clearer to understand.

    If possible, everytime I need this formula to multiply columns J and L and sum each time with appropriate conditions.
    Attached Files Attached Files

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: sum with if and multiply together

    Quote Originally Posted by PeteABC123 View Post
    ngngc:
    Try this in L5 and copy up and down.
    Formula: copy to clipboard
    =SUM($G$4*E5)+SUMIFS(G$4:G$20,$D$4:$D$20,$K5)

    Adjust $G$4 as appropriate. let us know if it works.
    Pete
    You dont meed to use SUM when multiplying 2 values/cells together...
    =$G$4*E5+SUMIFS(G$4:G$20,$D$4:$D$20,$K5)
    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

    Regards
    Ford

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,422

    Re: sum with if and multiply together

    Why in your example is 192108 not 142*58.62%+96*59.71%

  8. #8
    Registered User
    Join Date
    01-06-2016
    Location
    turkey
    MS-Off Ver
    office 2015
    Posts
    8

    Re: sum with if and multiply together

    Sorry about my mistake, please see the correction below;

    =142,00*58,62% = 83,24
    =96,00*59,71% = 57,32
    =SUMIFS(L$2:L$25;$I$2:$I$25;$Q2) = 42,00

    =83,24+57,32+42 = 182,56 kg

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,422

    Re: sum with if and multiply together

    I could only get the desired result by using a series of helper cells

    Helper 1: Gets the Product Code

    =IFERROR(INDEX($H$1:$H$25,SMALL(IF($I$1:$I$25=$Q$2,ROW($A$1:$A$25)-ROW($A$1)+1,""),ROWS($A$1:A1))),"")

    Enter with Ctrl+Shift+Enter and drag down

    Helper 2: Gets the RSN1 values

    =IFERROR(INDEX($L$1:$L$25,MATCH(1,($H$1:$H$25=$R19)*($K$1:$K$25="Product"),0)),"")

    Enter with Ctrl+Shift+Enter and drag down

    Helper 3: gets the % of ingredients

    =IFERROR(INDEX($J$1:$J$25,SMALL(IF($I$1:$I$25=$Q$2,ROW($A$1:$A$25)-ROW($A$1)+1,""),ROWS($A$1:C1))),"")

    Enter with Ctrl+Shift+Enter and drag down

    Calculations:

    Multiply "Helper 2" by "Helper 3"

    Add together with SUMIFS calculation
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    01-06-2016
    Location
    turkey
    MS-Off Ver
    office 2015
    Posts
    8

    Re: sum with if and multiply together

    Hello,

    Thank you for your help. Seems that there is no way to do it in one cell, so I also prepared one with more than one cell. Basically, I copied the columns K:O to Q:U and carried out the calculation like below;

    ***Ensuring that the column in the line of "Product" is empty (to avoid complication) and add these 3 formulas to each cells respectively,

    R3 (Ingredient 1) =IF($J3="";"";IF(L2="";"";$J3*L2)) [sorry I dont like to see anything if there is no numbers on the cell so I used IF)
    R4 (Ingredient 2) =IF($J4="";"";IF(L2="";"";$J4*L2))
    R5 (Ingredient 3) =IF($J5="";"";IF(L2="";"";$J5*L2))

    ***Then I drag these 4 cells (R2:R5) to the right (R2:U5).
    ***Then I drag down (R2:U5) until to have (R2:U25), eventually I have finished the calculation of dividing the product into ingredients.

    ***Later I added a formula to the cell X2 like below;

    Total amount of scrap for 192108 =SUMIFS(L$2:L$25;$I$2:$I$25;$W2)+SUMIFS(R$2:R$25;$I$2:$I$25;$W2)
    (sum for only 192108) (sum with dividing products)
    ***Then I drag the cell to right and down (X2:U6)
    Attached Files Attached Files

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,422

    Re: sum with if and multiply together

    The attached is your original file: did you mean to post your updated one?

  12. #12
    Registered User
    Join Date
    01-06-2016
    Location
    turkey
    MS-Off Ver
    office 2015
    Posts
    8

    Re: sum with if and multiply together

    I have uploaded the wrong file sorry. Please see attached file.
    Attached Files Attached Files
    Last edited by ngngc; 01-07-2016 at 08:21 AM.

  13. #13
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,422

    Re: sum with if and multiply together

    You could change

    =IF($J3="","",IF(L2="","",$J3*L2))

    to

    =IF(OR($J3="",L2=""),"",$J3*L2)

    I had worked my way through your solution but thanks for the update.

  14. #14
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,422

    Re: sum with if and multiply together

    If your problems is SOLVED, can you please mark thread as SOLVED ("Thread Tools" at top of first post).

    Thank you.

  15. #15
    Registered User
    Join Date
    01-06-2016
    Location
    turkey
    MS-Off Ver
    office 2015
    Posts
    8

    Re: sum with if and multiply together

    Thank you all for your help and efforts.

+ 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] Need to multiply a VLOOKUP value then divide that value, then multiply that value
    By debbiemez in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-27-2015, 04:57 PM
  2. multiply using VBA, please help!
    By iscar_marius in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-10-2014, 08:30 AM
  3. multiply
    By mertserveren in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-25-2014, 08:48 AM
  4. [SOLVED] trying to multiply a
    By Hilbro in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 01-22-2014, 11:38 PM
  5. Replies: 4
    Last Post: 01-10-2014, 09:32 AM
  6. If criteria match, multiply then sum across multiply worksheets
    By ciayers in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-09-2013, 02:20 PM
  7. [SOLVED] Multiply, Divide and Then Multiply in a cell
    By Brownie2576 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-22-2012, 08:57 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