Parse Sum

Stephen_IV

Well-known Member
Joined
Mar 17, 2003
Messages
1,168
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Fluff so graciously helped me out yesterday, I have been trying to find a formula that will sum all values with the name Mark in column A and then sum the position in column B. I have a helper column but would like a formula to do it without it. Any help would be appreciated.

Book1
ABCDEFG
1Names = MarkSum ValsMark1350
2Mark123123
3Paul/Don/Jeff/Mark234/987/728/910910
4Don/Mark119/211211
5Fred230
6Mark3434
7Al/Frank/Fred345/928/11990
8Paul3450
9Mark/Paul35/917735
10Al/Kenny/Fred45/87/430
11George/Larry/Don46/526/120
12Terry/Jim/Tom /Don/Fred/Mark/Jeff/Nick120/32/43/54/23/37/837
Sheet1
Cell Formulas
RangeFormula
G1G1=SUM(C2:C12)
C2:C12C2=IF(IFNA(MATCH("Mark",TEXTSPLIT(A2,"/"),0),0)>0,INDEX(TEXTSPLIT(B2,"/"),IFNA(MATCH("Mark",TEXTSPLIT(A2,"/"),0),0)),0)*1
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
How about
Excel Formula:
=SUM(BYROW(A2:B12,LAMBDA(br,--IFNA(INDEX(TEXTSPLIT(INDEX(br,,2),"/"),MATCH(F1,TEXTSPLIT(INDEX(br,,1),"/"),0)),0))))
 
Upvote 0
Still trying to get my head around the new 365 functions, below was my attempt - not sure if it is the best way to go about it:
Excel Formula:
=SUM(VALUE(IFERROR(MAP(A2:A12,B2:B12,LAMBDA(a,b,INDEX(TEXTSPLIT(b,"/"),MATCH(F1,TEXTSPLIT(a,"/"),0)))),0)))

Fluff:
In your formula above does: INDEX(br,,2) refer to column 2 of A2:B12?
 
Upvote 0
Thank you both!!!! Did exactly what I needed!!! Fluff thanks for the second time this week!!!!!
 
Upvote 0
That's right. :)

If it works that's what counts, what's more it's better than mine in that it will work if there is a blank cell in the range.
Thanks Fluff - this whole LAMBDA thing is blowing my mind

Thank you both!!!! Did exactly what I needed!!! Fluff thanks for the second time this week!!!!!
Happy to help - while helping myself ;)
 
Upvote 0
So I was testing some stuff and turns out textsplit function of excel 365 doesn't work on a range or array. So I made one myself which does.
I cannot find any bugs with it, let me know if you find any.
If anyone wanna try it out i attached the code with the formula below (y)
Excel Formula:
=SUMPRODUCT(IFERROR(((xlTEXTSPLIT(A2:A12,"/")="Mark")*(xlTEXTSPLIT(B2:B12,"/"))),0))

VBA Code:
Function XLTEXTSPLIT(D As Variant, DELIM As String) As Variant
            Dim v, FinAr, s, Temp, EA
            Dim m, MyR, MyC As Long
            v = D
            ReDim FinAr(1 To UBound(v), 1 To 1)
            
            For Each s In v
                    
                    Temp = Split(s, DELIM)
                    m = UBound(Temp) + 1
                    If m > UBound(FinAr, 2) Then ReDim Preserve FinAr(1 To UBound(v), 1 To m)
                    MyR = MyR + 1
                    MyC = 0
                    
                            Do
                    For Each EA In Temp
                            MyC = MyC + 1
                            FinAr(MyR, MyC) = EA
                    Next EA
                          Loop Until MyC = m
                    
                    
            Next s
                
            XLTEXTSPLIT = FinAr
        
        
End Function
 

Attachments

  • 1675859357999.png
    1675859357999.png
    32 KB · Views: 3
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,823
Members
449,049
Latest member
cybersurfer5000

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