How to include cells with today date in SUMIFS formula - excel

I've got raw data in a sheet with columns containing items number, product type, date, etc...
Date format is: 25-01-18 9:20
I'm trying to get a SUMIFS formula to report number of items arrived today.
Like =SUMIFS(Sheet2!G1:G924,Criteria1,Criteria2,etc)
Any idea?
Thanks in advance

If there are times in the data you can do >= today and < today+1 to count all items on todays date, e.g. if your date/times are in column H this sums column G for all today's items
=SUMIFS(Sheet2!G:G,Sheet2!H:H,">="&TODAY(),Sheet2!H:H,"<"&TODAY()+1)
Or for a simple count of today's items
=COUNTIFS(Sheet2!H:H,">="&TODAY(),Sheet2!H:H,"<"&TODAY()+1)

Related

Excel sum from multiple columns where date between several columns

I need help with excel sum calculating!
I have a table with 4 Amount Fields and 4 Date Fields
Excel Table
I need to Calculate sum from all amount columns which are in particular month and get a result like this:
January 2016 - Total Sum
January 2017 - Total Sum
etc...
I already try this:
=SUMIFS(A2:A9,B2:B9,">="&"09/01/2016",B2:B9,"<="&"09/30/2016")
for finding the sum for column A between dates in column B, but i cant figure out how to accomplish calculating sum for all Amount Columns which are between all Date Columns...
Thank You in advance for your help...
Try this:
=SUMIFS(A2:G9,B2:H9,">="&"09/01/2016",B2:H9,"<="&"09/30/2016")
Note how the columns are offset by one.

Excel - how to get if a date is a specific day of the week?

I have a spreadsheet that tracks average file processing times over the course of a month. One of the macros and stats that we like to pull, is performance on Mondays (as the files are a little built up over the weekend). The spreadsheet is organized into columns by weekdays of the month:
The dates are formatted MM/DD/YYYY, so I would think Excel has a date function that it can determine weekday based on that date value.
Currently, I just have to manually tell the Macro which columns are Mondays, like so:
=AVERAGE(B20,G20,L20,Q20)
So, instead of manually, how would I get the average over the range of say, B20 to V20, only if the day of the week is Monday (the date cells are in row 1, so B1 to V1)?
To determine the weekday of a date in EXCEL use the =WEEKDAY() formula, which evaluates as 1 (Sunday) to 7 (Saturday)
e.g. If A1 contains 12/31/2016 (or 31/12/2016 if you're from where I'm from), the formual =WEEKDAY(A1) would evaluate to 7 (indicating that the last day of 2016 was a Saturday)
To apply this formula to your problem: (assuming that the dates are in row 1 and the values are in row 2)
insert a new row to hold the WEEKDAY() value (say, row 2)
in cell A2 type in =WEEKDAY(A1)
copy this formula as far right as necessary (to include all your dates)
Your average for Mondays is calculated as =AVERAGEIF(2:2, 2, 3:3)
Possibly, you can add a column called [Day Of The Week] and use the following formula to display the day.
TEXT(B4,"dddd")
Then add an 'If'statement to your result cell.
simply
=SUMPRODUCT((MOD(B1:V1,7)=2)*B20:V20)/SUMPRODUCT((MOD(B1:V1,7)=2)*1)
should give the average of all values from B20 to V20 if the corresponding cell in row 1 is a monday.
the first part sums the values of all mondays and the second part counts them (sum / count = average) ;)
If you have any questions, just ask.
If your date is in A1, you can use =Text(A1,"dddd") to determine the day of the week (it will return the name, "Monday", "Tuesday", etc.) so then you could do perhaps:
=If(text(A1,"dddd")="Monday",[do whatever],[do whatever]) (may need a helper row/column to hold the text of the weekday)
(Or use AverageIf() and use the Text() idea.)

Extracting the month value from date field array

I have a spreadsheet with two columns of dates when a customer expressed interest in buying an item and a column of dates when the sale was actually made. I am trying to sum the total amount of sales when the month on the interest matches the month of the sale. For example:
Date of Interest Date of sale Price
04/15/2015 04/15/2015 $4,795
04/09/2015 04/27/2015 $3,596
03/31/2015 04/22/2015 $6,477
04/16/2015 04/28/2015 $9,755
The formula I am trying to use is this
=SUMIFS(E2:E15,MONTH(C2:C15),H2,MONTH(F2:F15),H2)
Where E2:E15 is the column of sales amount
C2:C15 is the date of interest
F2:F15 is the column of date of sale
H2 is a field that contains a month number (4 for this example)
If the formula worked, it should return a value of $18,146 (the sale of $6,477 would not included as the interest date was in month 3)
However, I get an error with the formula (no specific information). Is there anyway to extract the month number from both columns within this formula? I can create additional columns that have the month number and if I use them the formula works.
Any help would be greatly appreciated
Try:
=SUMPRODUCT((MONTH(Lead_date) = MONTH(Sold_Date))*Sold_Amt)
or:
=SUMPRODUCT((MONTH(Date_of_Interest)= MONTH(Date_of_sale))*Price)
If you want to restrict your answer to the month number contained in H2, as suggested by #user3578951, then simply modify the above to add that factor:
=SUMPRODUCT((MONTH(Date_of_Interest)= MONTH(Date_of_sale))*(MONTH(Date_of_Interest)=H2)*Price)
If you create a helper column to create a column of months (in number form), you can use your formula. Just insert a column next to your two date columns, and use =Month(C2) and drag down. Then you can just use =sumifs(e2:e100,_[lead date helper month range]_,h2,_[sold date helper month range]_,h2).

Excel: sum the last entries at month end query

I have a list of entries on a spreadsheet with a date and a percentage score. I need help in devising a formula whereby a user can select a month end date (i.e. 31 Jan) from a drop down and the average percentage of the last 15 entries will be returned.
There may be multiple entries on the same date but only the last 15 (based on the month end date) should be used. For simplicity the entries would be input in date order.
Let me know if you require any further information.
Thank you
P
Assuming your dates are in column A, the values in column B and the dropdown in D2:
=AVERAGE(OFFSET(B1,MATCH(D2,A:A,1)-1,0,-15,1))
*For this to work, your data will need to be sorted in date order!
**Also won't work if there are less than 15 rows (I assume this wouldn't be the case anyway)

Excel Countif using month and letter as Criteria's

I have a list of sales data that includes the date of the sale and also a sales type code. I'm trying to use COUNTIFS to count how many sales of a specific type there were during each month .
So for example:
Date. Sales Type Code
10/01/2014. S
12/01/2014. S
15/01/2014. O
18/01/2014. S
02/02/2014. O
08/02/2014. S
Would give me the following results:
Code S
January - 3
February - 1
Code O
January - 1
February - 1
I have the formula
COUNTIFS('SALES LEDGER'!A:A,F2,'SALES LEDGER'!C:C,"<"&EOMONTH('MONTH Sales by Sales Type'!$C$1,0)+1)
Where A:A is the list of Sales Type Codes, F2 is the code I want to count, C:C is the list of dates and C1 is the first of the month I want to count (ie. 01/01/2014).
This works fine for January, giving me the expected result. But when I change C1 to 01/02/2014, it counts January and February together, rather than just February.
If anyone has any suggestions it would be appreciated!
Thanks
Your COUNTIFS formula specifies an end date but no start date, if you want to count for a specific month and year (based on C1) you need another criterion to specify the start date using C1, i.e.
=COUNTIFS('SALES LEDGER'!A:A,F2,'SALES LEDGER'!C:C,"<"&EOMONTH('MONTH Sales by Sales Type'!$C$1,0)+1,'SALES LEDGER'!C:C,">="&'MONTH Sales by Sales Type'!$C$1)
You could use this one (if your range with dates doesn't contain empty cells):
=SUMPRODUCT((MONTH(A2:A100)=1)*(B2:B100="S"))
or (if your range could contain empty cells)
=SUMPRODUCT((TEXT(A2:A100,"mmm")="Jan")*(B2:B100="S"))
If you need to add also year condition, just add *(YEAR(A2:A100)=2014) in any formula:
=SUMPRODUCT((TEXT(A2:A100,"mmm")="Jan")*(YEAR(A2:A100)=2014)*(B2:B100="S"))
Assuming:
it is amenable to use helper columns
Dates in col A
Sale Type Codes in col B
Results placed from A9:C11
Screenshot:
Add a helper col C to extract Month from date. Add this formula in C2 and drag down:
=TEXT(A2,"Mmm")
Add this formula in B10 and drag down and across:
=COUNTIFS($B$1:$B$7,B$9,$C$1:$C$7,$A10)
with the code below you can retrieve the month each date is in:
dim objDate as Date
dim i as integer
dim intMonth as integer
for i = 2 to 'number of row
objDate = CDate(cells(i, 1))
intMonth = Month(objDate)
next i
After figuring out the month with a simple loop you can count the number of sales in each month.

Resources