Sumifs or VBA?

Razzy

Board Regular
Joined
Jul 24, 2020
Messages
106
Office Version
  1. 365
Platform
  1. Windows
Col A (variables) and Col B (sum values).


Keyword: BA-U01

*Variables in this order.


Eksample:

BA-U04
BA-U03
BA-U02
BA-U01
BA-E01
BA-E02
BA-E03
BA-E04
BA-E05
BA-E06
BA-E07
BA-E08
BA-E09
BA-E10
BA-E11
BA-E12
BA-E13
BA-E14
BA-E15
BA-E16
BA-E17
BA-E18
BA-E19
BA-E20

BB-U04
BB-U03
BB-U02
BB-U01
BB-E01
BB-E02
BB-E03
BB-E04
BB-E05
BB-E06
BB-E07
BB-E08
BB-E09
BB-E10
BB-E11
BB-E12
BB-E13
BB-E14
BB-E15
BB-E16
BB-E17
BB-E18
BB-E19
BB-E20


Task:
If I give you BA-E05, how to get everything summed in Col B, from variable and down?

I've messed around with SUMIFS(Col B, Col A, LEFT(text,FIND(character,text)-1)&"*") [sums all for example BA-*]

Then I need take minus where I am (easy vlookup BA-E05) and minus everything over (hard part!) BA-E05 (BA-E04, 3, 2,...)


VBA? xD
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Perhaps

=SUM(INDEX(B:B,MATCH("BA-E05",A:A,0)):INDEX(B:B,MATCH("zzzz",A:A,1)))
 
Upvote 0
How about
+Fluff New.xlsm
ABCDE
1
2BA-U041BA-E051140
3BA-U032BB-E08546
4BA-U023
5BA-U014
6BA-E015
7BA-E026
8BA-E037
9BA-E048
10BA-E0591140
11BA-E0610
12BA-E0711
13BA-E0812
14BA-E0913
15BA-E1014
16BA-E1115
17BA-E1216
18BA-E1317
19BA-E1418
20BA-E1519
21BA-E1620
22BA-E1721
23BA-E1822
24BA-E1923
25BA-E2024
26BB-U0425
27BB-U0326
28BB-U0227
29BB-U0128
30BB-E0129
31BB-E0230
32BB-E0331
33BB-E0432
34BB-E0533
35BB-E0634
36BB-E0735
37BB-E0836546
38BB-E0937
39BB-E1038
40BB-E1139
41BB-E1240
42BB-E1341
43BB-E1442
44BB-E1543
45BB-E1644
46BB-E1745
47BB-E1846
48BB-E1947
49BB-E2048
50
Lists
Cell Formulas
RangeFormula
E2:E3E2=SUM(INDEX($B$2:$B$49,MATCH(D2,$A$2:$A$49,0)):B$49)
C10,C37C10=SUM(B10:B$49)


In future please use the XL2BB add-in to post data to the board. Thanks
 
Upvote 0
How about

I wonder why I can't limist the match search to only BA- og BB- and so on by replacing "D2":

=SUM(INDEX($B$2:$B$49,MATCH(D2,$A$2:$A$49,0)):B$49)

With: LEFT(D2, FIND(E)-1)&"*") gives for example: BA-

=SUM(INDEX($B$2:$B$49,MATCH(LEFT(D2, FIND(E)-1)&"*"),$A$2:$A$49,0)):B$49)

If this work I only sum inside the same category BA og BB.
 
Upvote 0
How about
+Fluff New.xlsm
ABCDE
2BA-U041BA-E05264
3BA-U032BA-E05264
4BA-U023
5BA-U014
6BA-E015
7BA-E026
8BA-E037
9BA-E048
10BA-E059
11BA-E0610
12BA-E0711
13BA-E0812
14BA-E0913
15BA-E1014
16BA-E1115
17BA-E1216
18BA-E1317
19BA-E1418
20BA-E1519
21BA-E1620
22BA-E1721
23BA-E1822
24BA-E1923
25BA-E2024
26BB-U0425
27BB-U0326
28BB-U0227
29BB-U0128
30BB-E0129
31BB-E0230
32BB-E0331
33BB-E0432
34BB-E0533
35BB-E0634
36BB-E0735
37BB-E0836
38BB-E0937
39BB-E1038
40BB-E1139
41BB-E1240
42BB-E1341
43BB-E1442
44BB-E1543
45BB-E1644
46BB-E1745
47BB-E1846
48BB-E1947
49BB-E2048
Lists
Cell Formulas
RangeFormula
E2E2=SUM(FILTER(INDEX($B$2:$B$49,MATCH(D2,$A$2:$A$49,0)):B$49,LEFT(INDEX($A$2:$A$49,MATCH(D2,$A$2:$A$49,0)):A$49,2)=LEFT(D2,2)))
E3E3=SUMPRODUCT((LEFT(INDEX($A$2:$A$49,MATCH(D3,$A$2:$A$49,0)):A$49,2)=LEFT(D3,2))*(INDEX($B$2:$B$49,MATCH(D3,$A$2:$A$49,0)):B$49))
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,588
Members
449,089
Latest member
Motoracer88

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