Counting unique value with a date range

ajc623

Board Regular
Joined
Nov 8, 2013
Messages
58
I have a sheet with 60k+ lines of date for orders and I am wanting to pull the number of orders with a given date range based on a class of order. For this one I will just use all web orders as what I am looking at. There are several columns of date but the relevant ones are

Col B - date the order was placed
Col C - order #
Col F - Class of order (web)

I am currently using a sumif (see below) to track total dollars within the date ranges on a separate sheet, where I have the dates listed in Col R and the dollars in Col S. the data this formula is on is named 'Sales Date'.

=SUMIFS('Sales Data'!$I:$I,'Sales Data'!$F:$F,"*"&"web"&"*",'Sales Data'!$B:$B,">"&R7,'Sales Data'!$B:$B,"<="&R8)

The problem I run into is on the main data page there is a line for every item ordered, so if someone has 5 items in their web order it shows up 5 times but I would want it to only be counted once.

Any help would be appreciated.

Andrew
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Maybe something like this:
These are array formulas and must be entered with
Excel Workbook
ABCDEFGHIJKL
1DateOrder#ClassAmountStart DateEnd Date
24/9/2017Order#5Class214/11/20175/4/2017
34/11/2017Order#12Class32
44/11/2017Order#12Class33Class =web
54/14/2017Order#10web Class14
64/17/2017Order#3Class35Unique
74/21/2017Order#8Class26Count
84/23/2017Order#15Class372
94/24/2017Order#16webClass18
105/1/2017Order#16webClass19Sum
115/3/2017Order#18Class310Unique
125/4/2017Order#16Class11112
135/14/2017Order#14Class212
145/23/2017Order#17Class213
155/26/2017Order#2Class214
166/3/2017Order#13Class115
176/5/2017Order#6Class316
186/10/2017Order#19Class417
196/12/2017Order#7Class118
206/13/2017Order#11Class219
CTRL-SHIFT-ENTER.
 
Upvote 0
The SUMIFS formula you posted does not seem to agree on the ranges you describe. For example: SUMIFS is summing 'Sales Data'!$I:$I while you say "the dollars in Col S." Care to clarify? Even better post a tiny sample with the expected results...
 
Upvote 0
Aladin, below is a sample of what i am wanting to do. I added all the columns that are in the actual data sheet but only populated the relevant ones. Basically I would like to have a way to pull a total quantity of web orders (one example) within a given date range (most likely monthly) The problem is that if multiple products are in a single order then that order "Num" will show up multiple times. I looked at pivot tables but could not see a way to do this and was wondering if i could somehow do it like i have shown in column K & L. This would count the number of unique values under the "Num" column given that it fell between two dates, for the Qty "2" it would be >K2&<=K3 and for Qty "3" >K3&<=K4, and that the "Class" column contained the text string "web" ( "*"&"web"&"*" ). Thanks

Andrew

Excel Workbook
ABCDEFGHIJKL
1ItemDateNumMemoNameClassQtySales PriceAmount*Date RangeQty
2*5/25/20171**WEB****4/30/2017*
3*5/25/20172**PHONE****5/31/20172
4*5/27/20173**WEB****6/30/20173
5*5/27/20174**REP******
6*6/1/20175**WEB******
7*6/1/20175**WEB******
8*6/1/20176**REP******
9*6/5/20177**WEB******
10*6/5/20178**PHONE******
11*6/7/20179**WEB******
12*6/7/20179**WEB******
13*6/8/201710**REP******
Sheet1
 
Upvote 0
In L2 control+shift+enter, not just enter,and copy down:

=SUM(IF(FREQUENCY(IF($B$2:$B$13-DAY($B$2:$B$13)+1=$K2-DAY($K2)+1,IF(ISNUMBER(SEARCH("web",$F$2:$F$13)),$C$2:$C$13)),$C$2:$C$13),1))
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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