SUM OF VALUES IN A TEXT STRING, OF A COLUMN

Shakeable_Drip

Board Regular
Joined
May 30, 2023
Messages
50
Office Version
  1. 365
Platform
  1. Windows
can sumifs with MID-INDEX-MATCH be used to sum target text strings in a column? hopefully without a helper column.
unfortunately, mini table doesn't appear to be working for me, anyways. this adds to a project im working on over here.
the sequence of arguments or criteria is getting murky, maybe there is a better way?

Excel Formula:
=MID(INDEX(A:A,MATCH("*"&"      <Repeat> "&"*",A:A,0)),SEARCH(">",INDEX(A:A,MATCH("*"&"      <Repeat> "&"*",A:A,0)))+1,SEARCH("</",INDEX(A:A,MATCH("*"&"      <Repeat> "&"*",A:A,0)))-SEARCH(">",INDEX(A:A,MATCH("*"&"      <Repeat> "&"*",A:A,0)))-1)*1
DATA SETMID FOR "REPEAT"SUM OF ALL REPEAT
<Repeat> 16 </Repeat>1632
<Time> 145383 </Time>0
<Repeat> 16 </Repeat>16
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Try:

Excel Formula:
=SUM(--TRIM(MID(SUBSTITUTE(FILTER(A2:A4,ISNUMBER(SEARCH("Repeat",A2:A4)))," ",REPT(" ",99)),99,99)))
 
Last edited:
Upvote 0
Here's another way:

Book3
ABC
1DATA SETMID FOR "REPEAT"SUM OF ALL REPEAT
2<Repeat> 16 </Repeat>16342
3<Time> 145383 </Time>0
4<Repeat> 26 </Repeat>26
5<Repeat> 100 </Repeat>100
6<Repeat> 200 </Repeat>200
7<Time> 1111 </Time>0
Sheet3
Cell Formulas
RangeFormula
C2C2=SUM(B2:B7)
B2:B7B2=IF(ISNUMBER(SEARCH("<Repeat>",A2)),--TEXTBEFORE(TEXTAFTER(A2,"> "),"<"),0)
 
Upvote 0
A dynamic array also works.

Book3
ABC
1DATA SETMID FOR "REPEAT"SUM OF ALL REPEAT
2<Repeat> 16 </Repeat>16342
3<Time> 145383 </Time>0
4<Repeat> 26 </Repeat>26
5<Repeat> 100 </Repeat>100
6<Repeat> 200 </Repeat>200
7<Time> 1111 </Time>0
Sheet3
Cell Formulas
RangeFormula
B2:B7B2=IF(ISNUMBER(SEARCH("<Repeat>",A2:A7)),--TEXTBEFORE(TEXTAFTER(A2:A7,"> "),"<"),0)
C2C2=SUM(B2#)
Dynamic array formulas.
 
Upvote 0
If the sample data is representative, then other options (depending on functions available) are

23 06 03.xlsm
AB
1DATA SETSUM OF ALL REPEAT
2<Repeat> 16 </Repeat>342
3<Time> 145383 </Time>342
4<Repeat> 26 </Repeat>
5<Repeat> 100 </Repeat>
6<Repeat> 200 </Repeat>
7<Time> 1111 </Time>
Sum Repeat
Cell Formulas
RangeFormula
B2B2=SUM(--TEXTBEFORE(TEXTAFTER(FILTER(A2:A7,LEFT(A2:A7,2)="<R"),">"),"<"))
B3B3=SUM(IFERROR(--SUBSTITUTE(LEFT(A2:A7,FIND("</",A2:A7)-1),"<Repeat>",""),0))
 
Upvote 0
If the sample data is representative, then other options (depending on functions available) are

23 06 03.xlsm
AB
1DATA SETSUM OF ALL REPEAT
2<Repeat> 16 </Repeat>342
3<Time> 145383 </Time>342
4<Repeat> 26 </Repeat>
5<Repeat> 100 </Repeat>
6<Repeat> 200 </Repeat>
7<Time> 1111 </Time>
Sum Repeat
Cell Formulas
RangeFormula
B2B2=SUM(--TEXTBEFORE(TEXTAFTER(FILTER(A2:A7,LEFT(A2:A7,2)="<R"),">"),"<"))
B3B3=SUM(IFERROR(--SUBSTITUTE(LEFT(A2:A7,FIND("</",A2:A7)-1),"<Repeat>",""),0))
this looks like exactly what I need, but I get a #calc! error about empty arrays, is that because I'm trying to do the entire column of A:A or is this one of those equations you need to hold shift and enter<---- that didnt fix it.
 
Upvote 0
Try:

Excel Formula:
=SUM(--TRIM(MID(SUBSTITUTE(FILTER(A2:A4,ISNUMBER(SEARCH("Repeat",A2:A4)))," ",REPT(" ",99)),99,99)))
I like this method too but I got a value is of the wrong type error and I cant figure out what it is
 
Upvote 0
Here other to try:

Excel Formula:
=SUM(IFERROR(--SUBSTITUTE(SUBSTITUTE(A2:A4,"/",""),"<Repeat>",""),0))
 
Upvote 0
Solution
A dynamic array also works.

Book3
ABC
1DATA SETMID FOR "REPEAT"SUM OF ALL REPEAT
2<Repeat> 16 </Repeat>16342
3<Time> 145383 </Time>0
4<Repeat> 26 </Repeat>26
5<Repeat> 100 </Repeat>100
6<Repeat> 200 </Repeat>200
7<Time> 1111 </Time>0
Sheet3
Cell Formulas
RangeFormula
B2:B7B2=IF(ISNUMBER(SEARCH("<Repeat>",A2:A7)),--TEXTBEFORE(TEXTAFTER(A2:A7,"> "),"<"),0)
C2C2=SUM(B2#)
Dynamic array formulas.
Thank you for your post! I am hoping to do this without the helper column B or "mid for repeat"
 
Upvote 0

Forum statistics

Threads
1,215,107
Messages
6,123,126
Members
449,097
Latest member
mlckr

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