I'd like to organize dates in an excel spreadsheet into 2 month blocks. So if a date is in January or February, I'd like a function to return "Jan-Feb". If a date is in March or April, I'd like it to return "Mar-Apr" etc. I'm a complete novice at excel formulae. Any help would be greatly appreciated.
Try first creating an index which lists all the possible month combinations. ie, in cells J1:J12, enter "1" "2"..."12". Then in K1:K12, enter "January-February" "January-February""March-April""March-April"..."November-December".
Then put this formula instead of what you have above:
=index($K$1:$K$12,Match(Month(H3),$J$1:$J$12,0))
This works similar to a vlookup function - if you are more comfortable using vlookup, it would look like this:
=vlookup(month(H3),$K$1:$J$12,2,0)
Basically either function searches column K for the number of the month in H3, and then it provides the text string that you have manually typed in that row in column J.
Related
I'm started with the following:
=SUMIF(MONTH('Inventory'!K:K),B5,'Inventory'!M:M)
where MONTH('Inventory'!K:K) is supposed to return the month number (Jan=1, Feb=2, etc.) from a mm/dd/yyyy date column, B5 holds the month number I want to sum by, and 'Inventory'!M:M is an amount column.
In place of MONTH('Inventory'!K:K) I also tried LEFT('Inventory'!K:K, 1) with no luck.
I though possibly that the MONTH expression is returning a value where Excel is looking for a Range, but I wasn't able to find a workaround. Tried the following, which also didn't work:
=SUMIF('Inventory'!K:K,MONTH('Inventory'!K:K)=B5,'Inventory'!M:M)
While a pivot could work, I wanted the user to be able to just add to the Inventory tab without worrying about refreshing.
Create start and end dates from the numerical month in B5 rather than trying to convert the dates in column K to numerical month integers.
=SUMIFS('Inventory'!M:M, 'Inventory'!K:K, ">="&date(2017, B5, 1), 'Inventory'!K:K, "<"&date(2017, B5+1, 1))
Note SUMIFS, not SUMIF; they have a slightly different syntax.
Alternately, use SUMPRODUCT.
=SUMPRODUCT((MONTH('Inventory'!K:K)=B5)*('Inventory'!M:M))
You should trim down the full column references with SUMPRODUCT or be prepared to suffer calculation lag.
=SUMPRODUCT((MONTH('Inventory'!K2:index('Inventory'!K:K, match(1e99, 'Inventory'!K:K)))=B5)*('Inventory'!M2:index('Inventory'!M:M, match(1e99, 'Inventory'!K:K))))
Depends what you need, but here are two options that don't restrict you to one year's worth of months:
1) Create a helper column next to 'Inventory'!K:K to extract the month, then write your SUMIF using that column as the range.
2) Use SUMPRODUCT like so:
=SUMPRODUCT((MONTH('Inventory'!K:K)=B5)*'Inventory'!M:M)
I´ve spent a lot of time with a formula in Excel and I´m still blocked. I hope you can help me.
I have a table in Excel with several values as shown in this
screenshot.
What I´m trying to extract is the number of Fruits sold in a specific month. That is, how many lemons were sold in January 2016, for example. This is the formula I´m using:
=SUMPRODUCT((B3:B38=E4)*(MONTH($A$3:$A$150)=12)*(YEAR($A$3:$A$150)=2015);$C$3:$C$150)
But the result is #N/A as seen in the screenshot.
What Am I doing wrong? Any help, please?
Thanks a lot in advance!
You can use arrays in excel to get this answer
{SUM(IF(MONTH(F$3&"1")=MONTH($A$3:$A$150),IF($E4=$B$3:$B$150,$C$3:$C$150,0),0))}
You can use this Sumproduct formula which uses array logic:
SUMPRODUCT((MONTH($A$3:$A$38)=MONTH(TEXT(G$2,"MMM")&1))*($C$3:$C$38=$F4)*
($D$3:$D$38))
Sumproduct Demo
Part of your problem is your ranges are not equal in length. B3:B38 has to be the same number of rows as $A$3:$A$150 and C3:C150. When rows are not equal things blow up on you.
=SUMPRODUCT(($B$3:$B$150=$E4)*(MONTH($A$3:$A$150)=12)*(YEAR($A$3:$A$150)=2015);$C$3:$C$150)
if you change your header row to be actual excel date format, and then change the cell display format to just show the month (as suggested by csanjose), then you can adjust your sumproduct formula as follows and copy to all cells in your table.
=SUMPRODUCT(($B$3:$B$38=$E4)*(MONTH($A$3:$A$150)=Month(F$3))*(YEAR($A$3:$A$150)=Year(F$3));$C$3:$C$150)
Fill your month-row with the last day of each month, then apply date format to show only month name.
The formula you should use is, for example, in g8:
=SUMIFS($C:$C;$B:$B;$E8;$A:$A;"<="&G$3;$A:$A;">"&F$3)
First column "F" doesn't have a column on the left to compare, so you can put a date in E3 or change a bit the formula (example of F8):
=SUMIFS($C:$C;$B:$B;$E8;$A:$A;"<="&F$3;$A:$A;">2015/12/31")
Take a look at the result
If you don't want to use a pivot table, you can use this formula to get what you need:
=SUMPRODUCT(($B$3:$B$150=$E3)*(MONTH($A$3:$A$150)=1)*(YEAR($A$3:$A$150)=2015)*$C$3:$C$150)
Then drag-fill the cell to copy it to every month column (just make sure you change the month number in the formula (and year if you're doing that too)), and then drag-fill down the columns.
That should work pretty food good :)
Good Luck!
I have excel data in the following format
Date Amount
01-Jan-16 23.94
12-Jan-16 17.96
26-Jan-16 32.92
03-Feb-16 38.90
20-Feb-16 62.27
26-Feb-16 45.89
I would like to sum the amount field for specific months, that is I would like to sum up the amount in January and also in February separately.
This is the code I have tried thus far which I found in a previously asked question (see Excel Formula to SUMIF date falls in particular month).
=SUM(IF(MONTH(A:A)=1,B:B,0))
It works for January but when I change 1 to 2 it returns zero.
=SUM(IF(MONTH(A:A)=2,B:B,0))
Would sumifs work better?
Here are two other ways of doing it:-
=SUMPRODUCT((MONTH(A2:A10)=1)*B2:B10)
and
=SUMIFS(B2:B10,A2:A10,">="&DATE(2016,1,1),A2:A10,"<"&DATE(2016,2,1))
Change as necessary to get totals for other months.
I have put the results next to the original array formula in this screen shot:-
Use specific range rather than full column. You must use the formula as array formula.
=SUM(IF(MONTH($A$2:$A$1000)=1,$B$2:$B$1000,0))
Press CTRL+SHIFT+ENTER to evaluate the formula as array formula.
i have multiple columns in my excel spreadsheet (DOLLAR, Date, Year), i am trying to get the values in column DOLLAR, if the DATE is greater than 01 Jan 2014, and the YEAR is 2014.
I tried sumproduct, countifs, if, match and even combinations of them but i cant seem to get the value of DOLLAR based on the criteria. how would i go about doing this? i am still a bit new to this so i don't quite know all the functions yet.
i have something like this right now, also all the DOLLAR value that meets the criteria will all be summed up.
=IF('CDT DWGS-2014'!F:F=2014,IF('CDT DWGS-2014'!Q:Q>DATEVALUE("01-Jan-2014"),"GET DOLLAR VALUE",0),0)
Thank you
Ok, given your extra comments, I also tried to make it a bit more robust for you, so suppose, in your sheet you had:
A1 = Start Date
B1 = End Date
And in your CDT DWGS-2014 sheet, the Dollar amounts were in column A and the dates were in column B, You could use the following formula:
=SUMIFS('CDT DWGS-2014'!A:A,'CDT DWGS-2014'!B:B,">="&A1,'CDT DWGS-2014'!B:B,"<="&B1)
This could be made simpler, but this should do the trick.
Hope this helps!!
Use this formula. Column A, B and C are for DOLLAR, Date and Year respectively.
=SUMPRODUCT(A2:A11,--(B2:B11>DATE(2014,1,1)),--(C2:C11=2014))
I have several dates in a spreadsheet:
I would like to get the weeknumber in the column B for the date in column C in european time.
I tried something like that(and also that above):
= MID(TEXT(C2,"dd.m.yyyy"), 3, 2)
However that only gives me .2 in the B column...
Any suggestions on how to implement/start that?
I really appreciate your answer!
PS.: I also added excel tags because its similar to google spreadsheet. There is probably a chance that I can implement something from excel in google spreadsheet
in excel for get week number use
=WEEKNUM(C2)
Use the following formula
WeekDay(c2)
It will return the week day number.