Finding MAX value for a certain month - excel

I have a problem that shouldn't be a problem but I'm unable to solve it.
My data looks like this:
2012-04-05 1280
2012-04-17 1340
2012-04-20 1510
2012-05-03 1670
2012-05-09 1880
What I want to do is to find the MAX value for april and for may.
So MAX for april should return 1510 and MAX for may should return 1880. Can this be done?
EDIT:
Maybe simplified it a bit too much, here is an example closer to what I really want to do:
2012-04-04 14 220
2012-04-11 453 863
2012-04-19 900 1310
2012-05-02 1400 1810
2012-05-15 1900 2250
These are milage from my cars trip computer. I would like to calculate how far I drove each month.
For april: 1310-14 = 1296
For may: 2250-1400 = 850

A simple array formula can do this. If your dates are formatted as dates in Excel, paste the following into a cell and press Ctrl+Shift+Enter:
=MAX(IF(MONTH($A$1:$A$5)=4,B1:B5))
Can this be expanded to also allow 0 to be filtered out? When you use the MIN instead of MAX and your data range has empty values this results into 0 to be reported as the lowest value.

A simple array formula can do this. If your dates are formatted as dates in Excel, paste the following into a cell and press Ctrl+Shift+Enter:
=MAX(IF(MONTH($A$1:$A$5)=4,B1:B5))
If your dates are formatted as text, paste the following into a cell and press Ctrl+Shift+Enter:
=MAX(IF(MID($A$8:$A$12,6,2)="04",$B$8:$B$12))

if you just need the answer once, filter by month and run a max function.

You could use a pivot table. Below, Amount is summarized by Max. I right-clicked on the date column, chose Group By and then selected both Year and Month. The picture obviously shows the source data, pivot table and two dialogs. In practice you'd put the pivot table on its own worksheet:

You can use this simple formula to get max of the month in a given range.
where J2 - J7 is my date range, use Max to get maximum of the dates in that range and use text to get the month.
=TEXT(MAX(J2:J7),"mmm")

Related

Sum up numeric lead part of strings

Column1 Column2 Column3 Column4.
350 mac 360 jan
500 jan 200 mac
This is excel.. How to sum up in just one excel formula like you want a total for jan which is 860 and mac as well..
Thank you so much!
Please try this formula.
=SUM(IF(RIGHT(SumRng,3)=A$1,VALUE(LEFT(SumRng,LEN(SumRng)-4)),0))
SumRng is a named range containing all your items to be summed. In your example it may have been like A2:D2.
A1 contains the search text. In your example it's either "jan" or "mac". Note that it's not case sensitive. "Jan" and "Mac" will be included in the sum.
I tested the formula in Excel 365. However, in older versions of excel you may have to enter it as an array formula, confirming it with Ctl + Shift + Enter
I used an Excel table, and named it tbl.
If you have Excel O365, you can try:
=SUM(IF(H2=INDEX(tbl,SEQUENCE(ROWS(tbl)),SEQUENCE(,COLUMNS(tbl)-1,2,1)),INDEX(tbl,SEQUENCE(ROWS(tbl)),SEQUENCE(,COLUMNS(tbl)-1,1,1))))
The INDEX functions create two arrays, each one column less than the original table. When we see a match, we return the cell offset one to the left of the matched cell, giving you the totals you want.

Excel Formula to Calculate Text within a date range

I am trying to calculate values within a specific date range. The data I want to split between each month and the values: Successful, Incomplete and Failed.
I've tried pivot tables with this data but it doesn't work for me, also lacking pivot table excel experience. Formulas I'm more comfortable with.
I am using the following statement to at least get the total number of a value I add into it;
=COUNTIF('Jan 19'!$C$2:$C$1159,"Value")
Ex. If I put into the value "Successful" I get the total number of successful records.
I am looking into having a formula that I can input a specific month/date range (Jan, Feb, etc) and a value to get a count.
Ex. =Formula ((RangeOfData, "Value") AND (RangeOfData, (FromDate, ToDate))
I expect to the get the total number of a value(s) within a specific date range. If there isn't any data then the results would be blank or 0.
I'd use the formula COUNTIFS() as #cybernetic.nomad pointed in the comments so you can put more conditions on the COUNT:
=+COUNTIFS('Jan 19'!$B$2:$B$1159,">="&F3,'Jan 19'!$B$2:$B$1159,"<"&G3,'Jan 19'!$C$2:$C$1159,H3)
In the formula above I guessed the dates are in the COLUMN B, if not, you need to change it in the formula above.
To do that we should put the range we want to look at in a couple of cells where you would put the date range, in the example above:
F3 is the start date (if you want February of this year should be 1/2/2019).
G3 is the final date (if you want February of this year should be 1/3/2019).
H3 is where you can write "value", "successful" or any other string you are trying to count.

excel: comparison between hours

I have this worksheet to compare two hours with a condition and shows me a result.
If the value inserted in cell is less than the sum of two other hours, the conditional should warn me that I need to insert a bigger value.
I had wrote the formula below:
=IF(X4>(U4+$T$7);"The value is ok";"Insert a bigger value")
The following image represents cells affected on my worksheet:
Cells affected by formula.
As you may see my Excel is in Portuguese therefore the "SE" function is the same as "IF".
The X7 cell with "7:00:00" only represents the sum that I want to compare just to check if the result was correct.
Anyway, as you can see in this image the result is "Insert a bigger value" when actually, 17:00 (5 PM) is bigger than 7:00 (AM). Is there any way to solve this mistaken result?
All my cells are formated from "General" to "Hour".
use the hour function like this
if(hour(X4)

Use date values from different sheet in formula

I have two sheets in my excel file.
The first sheet contains values and dates, on the second I want to calculate values between a date range.
for instance:
50 20/9/2014
1600 16/10/2014
254 21/10/2014
1547 03/11/2014
(Belgian time)
I tried this with the following formula:
=SUMIFS(INPUT!$G$3:$G$100; INPUT!$H$3:$H$27; ">=01/10/2014"; INPUT!$H$3:$H$27; "<=31/10/2014")
This gives me an error in the formula and I notice that inside the formula values the date has become a random value:
Anyone has an idea how to do this correctly?
I couldn't find it at first either, but it seems your ranges need to be the same size (sum_range and criteria).
So change your sum_range to G3:G37 or your criteria range to H3:H100 and it will solve your problem. :)
Reference: http://www.excelforum.com/excel-formulas-and-functions/731875-sumifs-returns-value.html

SUM data according to dates in Excel

My problem is the following...
I have a little aeroplane and I need to track the hours. I have to track the hours by sectors and not the total of the day (that's why sometimes I have 2 or 3 on the same day).
Now this is the problem... On column C I need to SUM the hours of the last 7 days. And any given 7 days, not just last week. To do it manually is quite easy... the problem is that I need a formula as my records are quite large...
Here with a small example (let's say that there was NO HOURS before 15/01/2009)...
COLUMN A-------COLUMN B-------COLUMN C
DATE--------------HOURS-------HOURS LAST 7 DAYS
15/01/2009-------01:00-------01:00
15/01/2009-------02:15-------03:15
16/01/2009-------01:15-------04:30
17/01/2009-------01:30-------06:00
18/01/2009-------01:30-------07:30
18/01/2009-------01:00-------08:30
18/01/2009-------02:00-------10:30
19/01/2009-------02:30-------13:00
19/01/2009-------03:00-------16:00
20/01/2009-------////////--------16:00
21/01/2009-------01:00-------17:00
22/01/2009-------01:30-------15:15
23/01/2009-------02:00-------16:00
I've been fighting for the last weeks trying to figure out a formula but no luck... any suggestions?
Thanks
Another solution that basically does much the same as the earlier offered solutions:
In C1, enter the following formula:
{=SUM(IF(($A$1:$A1>=($A1-6))*($A$1:$A1<=$A1), $B$1:$B1, 0))}
And then just drag the formula down.
If you're not familiar with array formulas, the {} outer brackets just indicate that the formula is an array formula. To get it to execute correctly, you need to copy the part inside the {} brackets into the formula bar, and then hit Ctrl+Shift+Enter to indicate that it's an array formula.
First thing is to get the begin date, which would be the following function:
=Now() - 7
If you renamed that cell to "WeekBegin", then you could use the following formula to calculate the total hours:
=SUMIF(A:A,">=" & WeekBegin,B:B)
Notice that I used column references; this was to both simplify the formula, but also allow you to add new data to the end of the range easily. You will need to take care that your WeekBegin cell is not in that column A or column B, otherwise you'll get a circular reference warning.
If you planned to have numeric data above or below your input range, you would need to explicitly call out the sum and criteria ranges as follows:
=SUMIF(A2:A14,">=" & WeekBegin,B2:B14)
Additionally, you may find that your result comes up initially as a decimal. That's Excel's date serial format, so you may need to format your result as time.
Hope that helps!
[Edit: On second pass, if you're looking to sum a range based on a from and to date (so any 7 days as you seem to imply in your post), look for the previous poster's note, i.e.:
=SUM(B:B) - SUMIF(A:A, "<="& BeginDate, B:B) - SUMIF(A:A, ">"& EndDate, B:B)
A more elegant solution is offered in Excel 2007 using the SumIFS() function:
=SUMIFS(B:B, A:A, ">=" & FromDate,A:A, "<" & ToDate)
Note that the arguments for SUMIFS are in a different order than the standard SUMIF.
Happy Summing!]
Here's the data in better format if someone wants to try:
15-Jan-2009 01:00
15-Jan-2009 02:15
16-Jan-2009 01:15
17-Jan-2009 01:30
18-Jan-2009 01:30
18-Jan-2009 01:10
18-Jan-2009 02:00
19-Jan-2009 02:30
19-Jan-2009 03:00
20-Jan-2009
21-Jan-2009 01:00
22-Jan-2009 01:30
23-Jan-2009 02:00
I got the function:
=SUM($B$1:$B$13)-SUMIF($A$1:$A$13, "<="& (A1- 7), $B$1:$B$13) - SUMIF($A$1:$A$13, ">"& (A1), $B$1:$B$13)
This was based on Sum of named ranges conditional to date?.
The idea is to first compute the total sum: SUM($B$1:$B$13)
then subtract any values that happened older than 7 days ago: SUMIF($A$1:$A$13, "<="& (A1- 7), $B$1:$B$13)
then subtract any values that happened in the future: SUMIF($A$1:$A$13, ">"& (A1), $B$1:$B$13)
The point is to use SUMIF function, which "adds the cells specified by a given criteria."

Resources