SUMPRODUCT SUMIF wildcard help needed

twl2009

Board Regular
Joined
Jan 7, 2016
Messages
247
I have the below sumproduct formula which looks at another sheet holding sales orders.

=SUMPRODUCT(--('Sales by line'!$J:$J=$E7),--('Sales by line'!$G:$G>=M$4),--('Sales by line'!$G:$G<Q$4),'Sales by line'!$H:$H,'Sales by line'!$K:$K)


Col J matches to a product
Col G is a date
Col H is quantity
Col K is £

So this gives sum of prices paid for a certain product between two dates, so far so simple.

What i need to do next is add one more condition which looks at Col B, which holds order codes.

I need to be able to add a criteria that only shows order codes that start with certain letters.

In SumIf I could have used the wildcard feature &"*", but that doesnt work in sumproduct

I could easily have used the LEFT function except i need to check for different numbers of characters like "WS", "W" or just ""

In a SUMIF formula I would have used the below as range and criteria

,
'Sales by line'!$B:$B,$F$1&"*",



I have tried everything I can to get this working, but it is beyond me.



Any help would be amazing
Twl
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Hi, Can you try the below?

=
SUMPRODUCT(--('Sales by line'!$J:$J=$E7),--('Sales by line'!$G:$G>=M$4),--('Sales by line'!$G:$G<Q$4),--(ISNUMBER(SEARCH($F$1,'Sales by line'!$B:$B))),'Sales by line'!$H:$H,'Sales by line'!$K:$K)
 
Upvote 0
Bit of a longshot, but the cell F1 contains data validation drop down for the user to change. At the moment the entries would include first characters of an order ID, is there a way I could have something entered in F1 that would indicate everything but the characters entered. Like <>WO or "<>"&"WO" or anything this sort that would exclude this order type from the formula??
Thanks
Twl
 
Upvote 0
does F1 contain all possible order ID starting letters? if so and you want to exclude the one selected you could use:

=SUMPRODUCT(--('Sales by line'!$J:$J=$E7),--('Sales by line'!$G:$G>=M$4),--('Sales by line'!$G:$G<Q$4),--(NOT(ISNUMBER(SEARCH($F$1,'Sales by line'!$B:$B)))),'Sales by line'!$H:$H,'Sales by line'!$K:$K)


 
Upvote 0
Ah wait i could have another cell used when I need to exclusion code and have

=SUMPRODUCT(--('Sales by line'!$J:$J=$E7),--('Sales by line'!$G:$G>=M$4),--('Sales by line'!$G:$G<Q$4),--(ISNUMBER(SEARCH($F$1,'Sales by line'!$B:$B))),--(NOT(ISNUMBER(SEARCH($F$2,'Sales by line'!$B:$B)))),'Sales by line'!$H:$H,'Sales by line'!$K:$K)

would that work?
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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