SUMIFS a specific YEAR - excel

Could you help me to fix this excel error?
I'm trying to write a SUMIFS function. On my first page I have all my banking transaction sorted by date from 2011 to 2014. All transactions belong to one and only one category.
I need to sum my value in Sum_range only if my two criteria are true.
The year of the date should be the year specified in a cell
The category should be the category specified in another cell
I know the problem is about the year or the date because I can sum with my second condition only.

While SUMPRODUCT can use YEAR like this,
=SUMPRODUCT((YEAR('Transactions LU'!A:A)=A12)*('Transactions LU'!J:J=C11), 'Transactions LU'!H:H)
... you won't want to use full column references (slower) and SUMPRODUCT can easily break trying to perform math on an extra text value. SUMIFS is vastly more efficient and in the area of 30% of the calculation load.
=SUMIFS('Transactions LU'!H:H, 'Transactions LU'!A:A, ">="&DATE(A12, 1, 1), 'Transactions LU'!A:A, "<"&DATE(A12 +1, 1, 1), 'Transactions LU'!J:J, C11)
The second SUMIFS formula is much preferred.

Don't 100% understand the issue - but if it is really only the Year column that is making trouble try using Value(A12) or if that doesn't work TEXT(A12;0) this either converts the value to text or into number format. It depends whether your data column is in number or text format. (probably try TEXT first).

Related

Excel round multiple dates to a single one

I'm trying to put multiple rows which contain a date of the month between the first and last day of the month and I want to put them togeather as the first of the month dpeending on which month they are in:
for example; if they have the month of 12 i want to make them the 01/12/2020 if it was november 01/11/2020 and so on...
What i am looking for is to get three or more dates into a single one:
Date
03/12/2020
16/12/2020
27/12/2020
And make it:
Date
01/12/2020
Thanks for any help on how i could go about this, im struggling to find a solution
(I have tried text join and concatenate and neither work)
If you have Excel365 then use-
=DATE(2020,UNIQUE(MONTH(A1:A4)),1)
If you have dates with different years then try below formula.
=DATEVALUE("01-"&UNIQUE(TEXT(A1:A4,"mm-yyyy")))
Pretty unconventional way of doing it but works:
=EOMONTH(EDATE(AVERAGE(A1:A12),-1),0)+1
Where A1:A12 is a range of dates.
You have not specified well whether your dates are strings or actual Excel dates. Nor is it clear to me whether this is an example of a single cell in a larger row. The solution would be different based on the answer to these questions (which I do not have enough reputation to put as comments).
If you already have these values as dates put a new value in an adjacent column. Assuming the existing date value is in cell A1:
=DATE(YEAR(A1), MONTH(A1), 1)
However, if the date value is actually a string you will need to hard code the extraction of the values. Assuming, the are in fixed length strings as your image shows, with dd/mm/yyyy format:
=DATE(RIGHT(A1, 4), MID(A1, 4, 2), 1)

Find minimum date in row with multiple data types in Excel

I am trying to find the minimum date in a row that has both dates and number data types. I tried to use the MINIFS function but that still produces the number value as the minimum, rather than the date. I am restricted to doing this as an in-cell function, rather than in VBA. Also, the data structure is a bit wonky, I know, but it can't be changed.
=MINIFS(A2:C2,A2:C2,CELL("format",A2:C2)="D4")
When I enter =MIN(IF(A6:C6>40000,A6:C6)) I get a #Value error. Excel doesn't like the range before the > symbol.
Remember that dates in Excel are calculated as number of days starting from January 1st, 1900.
Thus, if you look at your dates as numbers, you will see that it's in fact a number '44042'.
Knowing that, you can use MIN together with IF formula:
=MIN(IF(B5:D5>43831,B5:D5))
Where your suggested numbers are in cells B5:D5 and '43831' is 2020/01/01.
Of course, if you have numbers with high values, this solution should be adapted.
Here's a screenshot I made:
img

Excel VLOOKUP with multiple possible options in table array

I have two lists, the first is a set of users. The second list contains different encounter dates for these users.
I need to identify the date that is within 10 days of the "Renew Date" [Column C], but not before. With Member 1 this would be row 3 1/8/2017. With Member 2 this would be row 6, 1/21/2017.
Now using a VLOOKUP which the user before me who managed this spreadsheet obviously isn't viable as it's simply going to pickup the first date that has a matching Member ID. Is there a way to do this in Excel at all?
I have included a link to a sample file and a screenshoit of the sample data.
https://drive.google.com/file/d/0B5kjsJZFrUgFcUFTNFBzQzN4cm8/view?usp=sharing
To avoid the slowness and complexities of array formulas, you can try with SUMIFS but the problem is that if you have more than one match, it will add them, not return the first match. The sum will look like an aberration. Will work however if you are guaranateed that you have only one match in the data.
An alternative is also to use AVERAGEIFS, which, in case of multiple matches, will give you their average and it will look like a valid date and a good result. Enter this formula in D2 and fill down the column:
D2:
=AVERAGEIFS(G:G,F:F,A2,G:G,">="&C2,G:G,"<="&C2+10)
and don't forget to format column D as Date.
Try this
=SUMPRODUCT($G$2:$G$7,--($F$2:$F$7=A2),--($G$2:$G$7<=C2+10),--($G$2:$G$7>C2))
Format the result as date. See screenshot (my system uses DMY order)
Don't use whole column references with this formula. It will slow down the workbook.

SUMIF doesn't work with nested MONTH or LEFT function

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)

Sumif Amounts Based on Months for Multiple Months

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.

Resources