total based on prodcuts name

Manoj K

New Member
Joined
Oct 22, 2021
Messages
34
Office Version
  1. 2013
Platform
  1. Windows
I have an excel file, which contains name of product with different packing structures. Against each product month wise production is written in another columns. Is there any formula to find out monthly production total based on products two or three words from left side.

1721449550483.png


thank you in advance
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
There were some mistake in product identification for total. Revised product based total is given. I would appreciate if anyone can give formula for monthly total based on product name

1721453286221.png
 
Upvote 0
Try this:
Excel Formula:
=SUM(ISNUMBER(FIND($A50,$A$46:$A49))*(B$46:B49))

Book1
ABCDEFGHIJKLMN
45SAP NAMEMonthly BudgetMay-23Jun-23Jul-23Aug-23Sep-23Oct-23Nov-23Dec-23Jan-24Feb-24Mar-24Apr-24
46ALMOTRIPTAN FOBV71248342657844464139198545
47ALMOTRIPTAN GNCJ38131721456378207979378554
48ALMOTRIPTAN XYAD20268685352299342132869426
49ALMOTRIPTAN CUDB93268796408162756468558392
50ALMOTRIPTAN22289273244185244283175205218197347217
51APIFEN APMW45509747383339885933295682
52APIFEN DFIY25989475991593738746281770
53APIFEN BXEA20626252226989111127888617
54APIFEN ROYI90417990362817773471349871
55APIFEN DFGD57956344507669478842837980
56APIFEN QTCM16369576228038125715378186
57APIFEN253382490384267301345308336234299417406
58APRAZOLE DKMA53269799891248737929777135
59APRAZOLE CKXJ36388192411132332079699229
60APRAZOLE BVTF48522023363286341964578214
61APRAZOLE HPCH66685236655248228233746381
62APRAZOLE ZFCC60198045268557181673542540
63APRAZOLE ZUYK51866261628856999359883657
64APRAZOLE TLSN60425686559166162056195767
65APRAZOLE MNDN67153817898084748023403098
66APRAZOLE441346486459463451477369409416478456421
67ARTEFAN HUPE58534649461672893885398929
68ARTEFAN DHFP49194885239331565721818226
69ARTEFAN PCCO47826246201885718120874331
70ARTEFAN MZHA13633282216132441584234030
71ARTEFAN RKAA13425372435580461182973571
72AFLOTIN ZYEG18738762827851964346986048
73AFLOTIN THZE40823476731371433061896318
74AFLOTIN OQLN81788744776643471759615077
75AFLOTIN TUYG19718359508734587831638171
76AFLOTIN LPHS35865548931231476476117455
77AFLOTIN YWRN59471856787481424834187231
78AFLOTIN BTTX92172664212983721575373565
79AFLOTIN344454390409474359394405295382377435365
Sheet1
Cell Formulas
RangeFormula
A50,A79,A66,A57A50=TEXTBEFORE(A49," ")
B50:N50,B79:N79,B66:N66,B57:N57B50=SUM(ISNUMBER(FIND($A50,$A$46:$A49))*(B$46:B49))



Sorry the values are not matching yours. I'm not going to recreate the scenario entirely from scratch. If you need it exact, then please use the xl2bb add in (link below) or share a link from an reputable file sharing site.
 
Upvote 0
I tried above formula, but not getting. Actually I had also done a mistake will requesting the formula. My data file will be continues without any row gap as given below. I need total of all matching products in seperate row below columns B,C,D, E, etc (like excel subtotal function) for matching word. eg One total for all Aflotin, another total for Almotriptan, another total for Apcycline, Aprifen, Aprazole, etc. Please help.

1721626476393.png


Actually I want result like below


1721626749089.png
 
Upvote 0
I tried above formula, but not getting.
What result are you getting? Is it an error? This doesn't help solve the question. Please give the error description or the "incorrect" result it gives, and what it should give? What is the formula you used (and what cell is it in)?



have two questions about your last post:

1. What is the formula you entered when you attempted the suggestion I gave?
(also give what cell address it is in).

2. You show one image with no subtotal line, and another with subtotal lines.
Are you asking for a macro that inserts new lines or asking for a pivot table on another worksheet?

Try inputting the suggestion I give into a new workbook or worksheet and see how it works with the data I have made up?


Below is the what I originally posted but with conditional formatting (except I could not "center" align column A header) to match your desired output format. (Note: the conditional formatting I'm using assumes your "category" name has no spaces in it. - you'll need to adjust accordingly if you have categories with spaces).

Please post a sample of your data using xl2bb (link below) or as a table (Images are not copyable data). I'm not going to type in all of your scenario - it is too time consuming and I think what I've given you should work. You just need to apply it to your data.

Book1
ABCDEFGHIJKLMN
1SAP NAMEMonthly BudgetMay-23Jun-23Jul-23Aug-23Sep-23Oct-23Nov-23Dec-23Jan-24Feb-24Mar-24Apr-24
2ALMOTRIPTAN FOBV71248342657844464139198545
3ALMOTRIPTAN GNCJ38131721456378207979378554
4ALMOTRIPTAN XYAD20268685352299342132869426
5ALMOTRIPTAN CUDB93268796408162756468558392
6ALMOTRIPTAN22289273244185244283175205218197347217
7APIFEN APMW45509747383339885933295682
8APIFEN DFIY25989475991593738746281770
9APIFEN BXEA20626252226989111127888617
10APIFEN ROYI90417990362817773471349871
11APIFEN DFGD57956344507669478842837980
12APIFEN QTCM16369576228038125715378186
13APIFEN253382490384267301345308336234299417406
14APRAZOLE DKMA53269799891248737929777135
15APRAZOLE CKXJ36388192411132332079699229
16APRAZOLE BVTF48522023363286341964578214
17APRAZOLE HPCH66685236655248228233746381
18APRAZOLE ZFCC60198045268557181673542540
19APRAZOLE ZUYK51866261628856999359883657
20APRAZOLE TLSN60425686559166162056195767
21APRAZOLE MNDN67153817898084748023403098
22APRAZOLE441346486459463451477369409416478456421
23ARTEFAN HUPE58534649461672893885398929
24ARTEFAN DHFP49194885239331565721818226
25ARTEFAN PCCO47826246201885718120874331
26ARTEFAN MZHA13633282216132441584234030
27ARTEFAN RKAA13425372435580461182973571
28AFLOTIN ZYEG18738762827851964346986048
29AFLOTIN THZE40823476731371433061896318
30AFLOTIN OQLN81788744776643471759615077
31AFLOTIN TUYG19718359508734587831638171
32AFLOTIN LPHS35865548931231476476117455
33AFLOTIN YWRN59471856787481424834187231
34AFLOTIN BTTX92172664212983721575373565
35AFLOTIN344454390409474359394405295382377435365
Sheet1
Cell Formulas
RangeFormula
B6:N6,B35:N35,B22:N22,B13:N13B6=SUM(ISNUMBER(FIND($A6,$A$2:$A5))*(B$2:B5))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A35Expression=ISNUMBER(FIND(" ",A2))=FALSEtextNO
B2:N35Expression=ISNUMBER(FIND(" ",$A2))=FALSEtextNO
 
Last edited:
Upvote 0
HEre is a Power Query Pivot Table where a new column for just the text before " " in the SAP NAME is used as a category.
(Power Query Syntax follows).
1721646819849.png



Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"SAP NAME", type text}, {"Monthly Budget", Int64.Type}, {"May-23", Int64.Type}, {"Jun-23", Int64.Type}, {"Jul-23", Int64.Type}, {"Aug-23", Int64.Type}, {"Sep-23", Int64.Type}, {"Oct-23", Int64.Type}, {"Nov-23", Int64.Type}, {"Dec-23", Int64.Type}, {"Jan-24", Int64.Type}, {"Feb-24", Int64.Type}, {"Mar-24", Int64.Type}, {"Apr-24", Int64.Type}}),
    #"Inserted Text Before Delimiter" = Table.AddColumn(#"Changed Type", "Text Before Delimiter", each Text.BeforeDelimiter([SAP NAME], " "), type text),
    #"Reordered Columns" = Table.ReorderColumns(#"Inserted Text Before Delimiter",{"Text Before Delimiter", "SAP NAME", "Monthly Budget", "May-23", "Jun-23", "Jul-23", "Aug-23", "Sep-23", "Oct-23", "Nov-23", "Dec-23", "Jan-24", "Feb-24", "Mar-24", "Apr-24"}),
    #"Renamed Columns" = Table.RenameColumns(#"Reordered Columns",{{"Text Before Delimiter", "Drug Category"}})
in
    #"Renamed Columns"

Here is the xl2bb of the sheet the pivot report is on, but it may not copy the pivot table functionality:

Book1
ABCDE
1Drug CategorySAP NAMESum of May-23Sum of Jun-23Sum of Jul-23
2AFLOTINAFLOTIN BTTX172664
3AFLOTIN LPHS865548
4AFLOTIN OQLN788744
5AFLOTIN THZE823476
6AFLOTIN TUYG718359
7AFLOTIN YWRN471856
8AFLOTIN ZYEG738762
9AFLOTIN Total454390409
10ALMOTRIPTANALMOTRIPTAN CUDB268796
11ALMOTRIPTAN FOBV248342
12ALMOTRIPTAN GNCJ131721
13ALMOTRIPTAN XYAD268685
14ALMOTRIPTAN Total89273244
15APIFENAPIFEN APMW509747
16APIFEN BXEA626252
17APIFEN DFGD956344
18APIFEN DFIY989475
19APIFEN QTCM369576
20APIFEN ROYI417990
21APIFEN Total382490384
22APRAZOLEAPRAZOLE BVTF522023
23APRAZOLE CKXJ388192
24APRAZOLE DKMA269799
25APRAZOLE HPCH685236
26APRAZOLE MNDN153817
27APRAZOLE TLSN425686
28APRAZOLE ZFCC198045
29APRAZOLE ZUYK866261
30APRAZOLE Total346486459
31ARTEFANARTEFAN DHFP194885
32ARTEFAN HUPE534649
33ARTEFAN MZHA633282
34ARTEFAN PCCO826246
35ARTEFAN RKAA425372
36ARTEFAN Total259241334
Sheet4
 

Attachments

  • 1721646649934.png
    1721646649934.png
    27.3 KB · Views: 2
Upvote 0
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,180
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top