Sum values between recurring text

Bahal

New Member
Joined
Jan 23, 2019
Messages
4
Hi,

Just looking to see if there is a method to sum values in a range between recurring words in a separate column.

I am trying to use one column for the formula in the total column. So far "=IFERROR(IF($B4*$C4=0,0,$B4*$C4),0)" is in column D with some conditional formatting. I would like to sum together the values for each transfer in the same row as "Transfer Note :" in column D.

Thank you in advance for any assistance.


ABCD
1NameQuantityCostTotal
2Transfer Date :24/01/2019 13:45:15
3Transfer Note :Freddy
4Pencil102.5025.00
5Soda34.0012.00
6Transfer Date :24/01/2019 13:43:21
7Transfer Note :Sherise
8Chips65.3031.80
9Transfer Date :23/01/2019 10:15:54
10Transfer Note :Terry
11Soda24.008.00
12Lollies88.2016.40
13Transfer Date :23/01/2019 09:58:30
14Transfer Note :Steve
15Paper130.172.21
16Beanie212.5025.00
17Milk53.7518.75
18

<tbody>
</tbody>
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
I took your data and normalized so that I could create a pivot table. I imported your data into Power Query and ran the following MCode.

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Quantity", type any}, {"Cost", type number}, {"Total", type number}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Transfer Date", each if[Name]="Transfer Date :" then [Quantity] else null),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "Transfer Note", each if [Name]= "Transfer Note :" then [Quantity] else null),
    #"Filled Down" = Table.FillDown(#"Added Custom1",{"Transfer Date", "Transfer Note"}),
    #"Removed Errors" = Table.RemoveRowsWithErrors(#"Filled Down", {"Cost"}),
    #"Filtered Rows" = Table.SelectRows(#"Removed Errors", each ([Cost] <> null)),
    #"Reordered Columns" = Table.ReorderColumns(#"Filtered Rows",{"Transfer Date", "Transfer Note", "Name", "Quantity", "Cost", "Total"})
in
    #"Reordered Columns"

With the data back in Excel Native, I then created a Pivot Table as shown below.

Data Range
H
I
J
K
1
2
Transfer Date​
Transfer Note​
Name​
Sum of Total​
3
23/01/2019 09:58:30​
4
Steve​
5
Beanie​
25​
6
Milk​
18.75​
7
Paper​
2.21​
8
Steve Total​
45.96​
9
23/01/2019 09:58:30 Total​
45.96​
10
23/01/2019 10:15:54​
11
Terry​
12
Lollies​
16.4​
13
Soda​
8​
14
Terry Total​
24.4​
15
23/01/2019 10:15:54 Total​
24.4​
16
24/01/2019 13:43:21​
17
Sherise​
18
Chips​
31.8​
19
Sherise Total​
31.8​
20
24/01/2019 13:43:21 Total​
31.8​
21
24/01/2019 13:45:15​
22
Freddy​
23
Pencil​
25​
24
Soda​
12​
25
Freddy Total​
37​
26
24/01/2019 13:45:15 Total​
37​
 
Upvote 0
Thanks for the reply.

I'm not very good with pivot tables and in my table before, columns A to C are a generated report from a third party program and I was hoping to have column D be copy and pasted into the generated report thus totalling each item and then each transfer note in the same column. I wasn't sure if that was even possible and couldn't find anything through Googling.
 
Upvote 0
is that what you want?

NameQuantityCostTotalSum
Transfer Date :24/01/2019 13:45:15
Transfer Note :Freddy
37​
Pencil10
2.5​
25​
Soda3
4​
12​
Transfer Date :24/01/2019 13:43:21
Transfer Note :Sherise
31.8​
Chips6
5.3​
31.8​
Transfer Date :23/01/2019 10:15:54
Transfer Note :Terry
24.4​
Soda2
4​
8​
Lollies8
8.2​
16.4​
Transfer Date :23/01/2019 09:58:30
Transfer Note :Steve
45.96​
Paper13
0.17​
2.21​
Beanie2
12.5​
25​
Milk5
3.75​
18.75​

or

NameQuantityCostTotals
Transfer Date :24/01/2019 13:45:15
Transfer Note :Freddy
37​
Pencil10
2.5​
25​
Soda3
4​
12​
Transfer Date :24/01/2019 13:43:21
Transfer Note :Sherise
31.8​
Chips6
5.3​
31.8​
Transfer Date :23/01/2019 10:15:54
Transfer Note :Terry
24.4​
Soda2
4​
8​
Lollies8
8.2​
16.4​
Transfer Date :23/01/2019 09:58:30
Transfer Note :Steve
45.96​
Paper13
0.17​
2.21​
Beanie2
12.5​
25​
Milk5
3.75​
18.75​


or post expected result
 
Last edited:
Upvote 0
Since your raw data is not normalized, you need to normalize it for analysis and computation. And Pivot Tables are important to analysis. Suggest you look at some on line tutorials to get this important feature as part of your excel repertoire. Otherwise, I have nothing more to offer on this issue. Good luck with finding an alternative solution.
 
Last edited:
Upvote 0
is that what you want?

[COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]Name[/COLOR][COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]Quantity[/COLOR][COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]Cost[/COLOR][COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]Total[/COLOR][COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]Sum[/COLOR]
Transfer Date :24/01/2019 13:45:15
Transfer Note :Freddy
37​
Pencil10
2.5​
25​
Soda3
4​
12​
Transfer Date :24/01/2019 13:43:21
Transfer Note :Sherise
31.8​
Chips6
5.3​
31.8​
Transfer Date :23/01/2019 10:15:54
Transfer Note :Terry
24.4​
Soda2
4​
8​
Lollies8
8.2​
16.4​
Transfer Date :23/01/2019 09:58:30
Transfer Note :Steve
45.96​
Paper13
0.17​
2.21​
Beanie2
12.5​
25​
Milk5
3.75​
18.75​

<tbody>
</tbody>


or

[COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]Name[/COLOR][COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]Quantity[/COLOR][COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]Cost[/COLOR][COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]Totals[/COLOR]
Transfer Date :24/01/2019 13:45:15
Transfer Note :Freddy
37​
Pencil10
2.5​
25​
Soda3
4​
12​
Transfer Date :24/01/2019 13:43:21
Transfer Note :Sherise
31.8​
Chips6
5.3​
31.8​
Transfer Date :23/01/2019 10:15:54
Transfer Note :Terry
24.4​
Soda2
4​
8​
Lollies8
8.2​
16.4​
Transfer Date :23/01/2019 09:58:30
Transfer Note :Steve
45.96​
Paper13
0.17​
2.21​
Beanie2
12.5​
25​
Milk5
3.75​
18.75​

<tbody>
</tbody>



or post expected result

The second table is what I as after.
 
Upvote 0
Try this formula in D2, and copy down:

=IF(A2="Transfer Note :",SUM(D3:INDEX(D3:D23,IFERROR(MATCH("Transfer Date :",A3:A23,0),20))),IFERROR(B2*C2,""))

This assumes a maximum of 20 rows per section. If you anticipate more than that, change the values in red.
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,241
Members
449,075
Latest member
staticfluids

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