Sumif combinations of a number

Joined
Jan 13, 2021
Messages
20
Office Version
  1. 2007
Platform
  1. Windows
=SUMIFS(AD2:AD1000, AF2:AF1000, "*123*")

The formula above is supposed to find all combinations of 123 in column AD and sums up the corresponding cells in column AF. By combinations of 123, I mean:

123
132
231
213
312
321

The code just returns the value "0" to me. What can be done? Take note, I use Excel 2007.

Thank you
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Try this:
=SUMPRODUCT((AD2:AD7)*(ISNUMBER(FIND("123",AF2:AF7))))
(you may need to enter the formula with CNTR-SHFT-ENTR keystroke)

Mr Excel Questions 73.xlsm
ADAEAFAG
1120
2120123.00
3121132.00
4121231.00
5123213.00
6124312.00
7122321.00
wonderfulsomebod
Cell Formulas
RangeFormula
AG1AG1=SUMPRODUCT((AD2:AD7)*(ISNUMBER(FIND("123",AF2:AF7))))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Last edited:
Upvote 0
Solution
Try this:
=SUMPRODUCT((A5:A10)*(ISNUMBER(FIND("123",A5:A10))))
(you may need to enter the formula with CNTR-SHFT-ENTR keystroke)

Mr Excel Questions 73.xlsm
ABC
1
2
3
4
5123.00123
6132.00
7231.00
8213.00
9312.00
10321.00
wonderfulsomebod
Cell Formulas
RangeFormula
C5C5=SUMPRODUCT((A5:A10)*(ISNUMBER(FIND("123",A5:A10))))
Press CTRL+SHIFT+ENTER to enter array formulas.
=SUMPRODUCT((AF2:AF1000)*(ISNUMBER(FIND("123",AD2:AD1000))))

This code did accurately bring back the sum of 123, but only 123. Not the combinations of 123 - like 321 and so on. I don't want to enter each of the 6 combinations separately because I plan on using different combinations of numbers in the future.
 
Upvote 0
Will it only be 3 numerals? Will they be consecutive (is "1392" a hit?)
 
Upvote 0
Will it only be 3 numerals? Will they be consecutive (is "1392" a hit?)
Yes they will always be 3 numerals of the combination of the number I enter. For example, if the number is 605, I want all combinations of that number including the 0 in front:

605
650
560
506
065
056

It finds those numbers and sums up the corresponding cells.
 
Upvote 0
you didn't answer the second question.

but try this:

Mr Excel Questions 73.xlsm
ADAEAFAG
1target:123Sum:731
2120123.00
3121132.00
4121231.00
5123213.00
6124312.00
7122321.00
wonderfulsomebod
Cell Formulas
RangeFormula
AG1AG1=SUMPRODUCT((AD2:AD7)* (ISNUMBER(FIND(MID(AE1,1,1),AF2:AF7)))* (ISNUMBER(FIND(MID(AE1,2,1),AF2:AF7)))* (ISNUMBER(FIND(MID(AE1,3,1),AF2:AF7))) )
 
Last edited:
Upvote 0
you didn't answer the second question.
1392 should not be a hit as it's 4 digits long. Only 3 digit numbers that meet the combinations of a particular number such as 123, 321, 213, 231,132, and 312. It finds those specific combinations in column AD and sums up their cells from column AF.

Edit: that new formula didn't work for me at all.
 
Upvote 0
ok, try the updated formula in post #6.
I tried, it gives me value 0, which is the wrong sum. So far the most accurate formula shows the right sum for 123. It just doesn't include all 6 combinations of 123:

=SUMPRODUCT((AF2:AF1000)*(ISNUMBER(FIND("123",AD2:AD1000))))
 
Upvote 0
did you enter with CNTL-SHFT-ENTER keystroke?
 
Upvote 0

Forum statistics

Threads
1,223,879
Messages
6,175,145
Members
452,615
Latest member
bogeys2birdies

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