Sumif with condition similar

alfordtp

Board Regular
Joined
Oct 3, 2008
Messages
62
When you filter a spreadsheet, you can find results that are similar to a condition. I have families of products that share a common 3 digits, but the rest of the model number is different. The 3 similar digits could be the first 3 digits, or it could be 3 digits starting with the 2nd digit. This spreadsheet has each complete model number on its own row. In that row is a number that represents a volume. I want to be able to sum the volume column if the model number contains the 3 digits.[TABLE="class: grid, width: 20"]
<tbody>[TR]
[TD]Model Number[/TD]
[TD]Volume[/TD]
[/TR]
[TR]
[TD]A hat[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]B hat[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]A glove[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]hat[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

In the above example, the total for "hat" = 5 + 1 + 8 = 14

I would type in a condition (family name) into another cell (D1) and the formula in D2.
 

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.
Excel does funny things when there are numbers and letters in the same cell.

For the example above, if there was another column with a sku associated, like 123a = a hat, 123b = b hat, 124a = a glove, and 123 = hat. How could I apply the above formula, or something similar, if I wanted to find all "123" records and sum that volume column?
 
Upvote 0
Excel does funny things when there are numbers and letters in the same cell.

For the example above, if there was another column with a sku associated, like 123a = a hat, 123b = b hat, 124a = a glove, and 123 = hat. How could I apply the above formula, or something similar, if I wanted to find all "123" records and sum that volume column?

Could you provide an example and expected result?

M.
 
Upvote 0
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]SKU[/TD]
[TD]Model[/TD]
[TD]Volume[/TD]
[/TR]
[TR]
[TD]123a[/TD]
[TD]A hat[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]123b[/TD]
[TD]B hat[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]124a[/TD]
[TD]A glove[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]hat[/TD]
[TD]8[/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]SKU[/TD]
[TD]Volume Sum[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]5 + 1 + 8 = 14[/TD]
[/TR]
</tbody>[/TABLE]

When I used the formula from above, it did not give me 14. I think it has to do with how the SKU column is stored as text or as a number. Is there a way around that?
 
Upvote 0
It worked perfectly for me


[TABLE="class: grid"]
<TBODY>[TR]
[TD][/TD]
[TD]
A
[/TD]
[TD]
B
[/TD]
[TD]
C
[/TD]
[/TR]
[TR]
[TD]
1
[/TD]
[TD]
SKU​
[/TD]
[TD]
Model​
[/TD]
[TD]
Volume​
[/TD]
[/TR]
[TR]
[TD]
2
[/TD]
[TD]
123a​
[/TD]
[TD]
A hat​
[/TD]
[TD]
5​
[/TD]
[/TR]
[TR]
[TD]
3
[/TD]
[TD]
123b​
[/TD]
[TD]
B hat​
[/TD]
[TD]
1​
[/TD]
[/TR]
[TR]
[TD]
4
[/TD]
[TD]
124a​
[/TD]
[TD]
A glove​
[/TD]
[TD]
4​
[/TD]
[/TR]
[TR]
[TD]
5
[/TD]
[TD]
123​
[/TD]
[TD]
hat​
[/TD]
[TD]
8​
[/TD]
[/TR]
[TR]
[TD]
6
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
7
[/TD]
[TD]
SKU​
[/TD]
[TD]
Volume Sum​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
8
[/TD]
[TD]
123​
[/TD]
[TD]
14​
[/TD]
[TD][/TD]
[/TR]
</TBODY>[/TABLE]


Formula in B8
=SUMPRODUCT(--ISNUMBER(SEARCH(A8,$A$2:$A$5)),$C$2:$C$5)

M.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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