I have data that shows an item description and the sale date, stored in a table. I want to count the number of sales made in a week using the countif function and store it in another table. I have looked and looked, and can't seem to find a solution. Please see the attached Excel file.
I wish I could use something like the following function, but it is invalid.
=COUNTIF(WEEKNUM(Table1[Date]),[@Week])
Thanks in advance.
Last edited by perducci; 01-19-2012 at 10:16 AM.
The best/easiest way is to add another column to the main table with formula: =WEEKNUM(B3) copied down
and then:
=COUNTIF(Table1[Week Number],Table2[[#This Row],[Week]])
where Week Number is new column header.
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
That is the easiest but I was hoping to find a way without adding an extra column to the first table. I want another person to be able to cut and paste data into the table 1 and have it update the weekly data. Are there any other options?
thanks
Try then:
=SUMPRODUCT(--((1+INT((Table1[Date]-DATE(YEAR(Table1[Date]+4-WEEKDAY(Table1[Date]+6)),1,5)+WEEKDAY(DATE(YEAR(Table1[Date]+4-WEEKDAY(Table1[Date]+6)),1,3)))/7))=Table2[[#This Row],[Week]]))
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
That works. Thank you so much!
I am baffled by this equation. I'm now trying to perform the same task but aggrthe data into months. Can someone explain the solution above and help me aggregate the count into months?
Thanks
In G3 to down enter first day of each month. eg: 1/1/2012, 2/1/2012 etc.. then
for the COUNT,
=COUNTIFS(Table1[Date],">="&G3,Table1[Date],"<="&EOMONTH(G3,0))
For the Revenue,
=SUMIFS(Table1[Price],Table1[Date],">="&G3,Table1[Date],"<="&EOMONTH(G3,0))
HTH; Haseeb
If your problem is solved, please say so clearly, and mark your thread as Solved:
Forum Rules & How to Mark a thread as SOLVED
Another option:
H3:
I3:=SUMPRODUCT(1*(MONTH(Table1[Date])=Table2[[#This Row],[Month]]))
=SUMPRODUCT((MONTH(Table1[Date])=Table2[[#This Row],[Month]])*Table1[Price])
Click the star icon in left-corner of my post if you find my post userful!
Quang PT
quangphanidico@yahoo.com
PM me: Y!M: quangphanidico
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks