Excel Formula Help - need excel to look up a text and sum all values that have that text in multiple rows and columns

mnminutoli

New Member
Joined
Oct 25, 2018
Messages
1
I am hoping someone could help me with an excel function I am struggling with.

I have two tables one in sheet one and one in sheet two (as shown below). I want to generate an excel formula that will sum all the values for Q1 - Q4 that match each fruit name in the summary table on sheet 2. So for example, apples would be 515. There are multiple rows with the word "apples" and multiple columns (Q1-Q4) that have data for "apples". Does anyone know how I can do this?

Sheet 1:

Q1 Q2 Q3 Q4
Apples9020590
Oranges20202020
Oranges40304040
Oranges5040550
Apples80708080
Mangoes20202020
Mangoes30103030

<colgroup><col width="64" span="5" style="width:48pt"> </colgroup><tbody>
</tbody>

Sheet 2:

Total
Apples (Formula)should be 515
Oranges (Formula)
Mangoes (Formula)

<colgroup><col><col><col></colgroup><tbody>
</tbody>

<colgroup><col><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
maybe it will help with PowerQuery:

ItemQ1Q2Q3Q4ItemSum
Apples
90​
20​
5​
90​
Apples
515​
Oranges
20​
20​
20​
20​
Oranges
375​
Oranges
40​
30​
40​
40​
Mangoes
180​
Oranges
50​
40​
5​
50​
Apples
80​
70​
80​
80​
Mangoes
20​
20​
20​
20​
Mangoes
30​
10​
30​
30​

Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Item", type text}, {"Q1", Int64.Type}, {"Q2", Int64.Type}, {"Q3", Int64.Type}, {"Q4", Int64.Type}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Item"}, "Attribute", "Value"),
    #"Grouped Rows" = Table.Group(#"Unpivoted Other Columns", {"Item"}, {{"Sum", each List.Sum([Value]), type number}})
in
    #"Grouped Rows"[/SIZE]
 
Upvote 0
Try

Sheet2
Formula in B2 copied down
=SUMPRODUCT((Sheet1!A$2:A$8=A2)*Sheet1!B$2:E$8)

M.
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,897
Members
449,097
Latest member
dbomb1414

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