I'm having an trouble making an excel formula at the moment which would first search for the value by getting the year from the dates and then search another value from the sheet. Finally return the count.
Please, let me know how can I do this. I've been stuck at this a long time.
Right now i'm using this formula.
=COUNTIFS('Inc'!$F$2:$F$984,"YEAR('Incg'!$F$2:$F$984)=2017",'Incident Log'!$J$2:$J$984,$F9)`
You can't use YEAR() as an argument to COUNTIFS in this case, because its output is the numerical value 2017 whereas the value you want to use for your comparison is 42736, the internal representation of this year. A possible workaround is:
=COUNTIFS('Incident Log'!$F$2:$F$984,">="&DATE(2017,1,1),'Incident Log'!$F$2:$F$984,"<"&DATE(2018,1,1), ...)
This extracts the numerical date values of January 1 2017 and 2018, and checks whether each value lies between those dates.
If you do want to use YEAR() then you can use it with SUMPRODUCT, which was the usual way of solving problems like this before COUNTIFS became available.
=SUMPRODUCT(--(YEAR('Incident Log'!$F$2:$F$984)=2017),--('Incident Log'!$J$2:$J$984=$F9))
Related
I'm having a strange issue here with Excel. I'm working with a custom datetime format in one column...
9/1/2017 12:02:01 AM
This is cell C2. However, using LEN on this cell gives me this...
1900-01-15 00:00:00
I've tried changing the format to General, or Text, and messing around with some custom datetimes, but it doesn't help. I will get the same answer. My goal here is to use this as an exercise and trim the date and time, putting them in separate columns. This spreadsheet was originally created using Google Sheets, not sure if that might explain it?
UPDATE: Ok, so about 1 minute after posting this I think I figured it out? I used LEN in the column to the left of column C, so B. I had been using column D. For some reason, column B returned the numerical value. Obviously I'm very new to Excel. I didn't think column placement mattered in this case. Why does it?
That's because you have formatted the result to be shown as a date.
Remember, dates are simply really large numbers. So, what has happened here is that you get the correct result from LEN(), but then you have formatted this result to be interpreted as a date.
The date seems to indicate the result was 15. In dates, this is 15 full days from 1900 January 1st.
So, you just have to change the format of that cell from a date, to be a number :)
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
I have a series of dates and values:
8.12.2018 12
5.2.2019 32
15.7.2019 89
I would like to use something like (SUMIFS(YEAR(A1:A3);2018) but it's not allowed.
I know, I could extract the year in a separate column, but here I want to ask, if it's possible inside the sumifs function?
Although I thought you couldnt, it has proven by #forwardEd, you can alter criteria in such a way to use SUMIFS, however, you could also look into SUMPRODUCT for this exercize:
=SUMPRODUCT(--(YEAR(A1:A3)=2018),B1:B3)
Assuming your dates are valid excel dates and not dates as strings/text then you can use the SUMIFS formula for a year as follows:
=SUMIFS(B1:B3,A1:A3,">="&date(2018,01,01),A1:A3,"<="&date(2018,12,31))
Basically the formula is saying sum all the values in B1:B3 where the date in A1:A3 is greater than or equal to the first day of the year AND less than or equal to the last day of the year. I choose to write the date using the date function as it is easier to recognize than the integer format of the date. If you want to write just the year as a criteria in say cell c2 then replace 2018 in the above formula with c2.
UPDATE
I have not tested it but since the default for a date without time is 00:00:00 it would mean the formula above would cut off December 31 with almost any sort of time associated with it. Therefor the better cut off would be less than January 1st of the following year instead of less than or equal to December 31st. As such you could revise the above formula to:
=SUMIFS(B1:B3,A1:A3,">="&date(2018,01,01),A1:A3,"<"&date(2019,01,01))
or
Where C2 is the year as an integer
=SUMIFS(B1:B3,A1:A3,">="&date(C2,01,01),A1:A3,"<"&date(C2+1,01,01))
Alternative approach (a little bit less elegant solution, but might be more clear to less advanced users):
=SUMIFS(B1:B4,A1:A4,">="&"01/01/2018",A1:A4,"<="&"31/12/2018")
I want to program a cell to calculate the number of days I have left before I meet a deadline.
I would like to do this without reference cells, unlike this tutorial.
An (incorrectly formatted) example of the kind of formula I want would be:=(3/2/2015-TODAY()), where 3/2/2015 is my deadline. This yields some negative serial number,-42051.00, which yields a #NUM! error when put into the DAY formula.
Any idea how to do this without putting TODAY() and 3/2/2015 into their own reference cells? I would like to use functions to keep these paraments completely embedded in the formula.
Right clock the cell with the answer and reformat it as NUMBER. You want to use the Days function not the date function.
=DATE(2015,3,2)-TODAY() is what you want, but I would recommend doing the date in a separate cell for a number of reasons and using "today()" in the formula.
EDIT: Anyone trying to find midpoints would use the date function in this case.
Also, as a general rule for people trying to subtract dates the two trouble shooting methods you want are
A) Check your format-If you want number of dates, it needs to be set as number, if you want a date, you need it to set as date. If you get a long decimal it means you have it formatted as general OR your expression returns a date value rather than a number value. Refer to my original answer.
B) Reverse your dates. Depending on the function and what you want, you may need to move the dates around.
=DATEDIF(DATEVALUE("03/02/2015"), TODAY(), "d")
I will give you an example right away. I have dates in a column (F) as text in this format. Jan 31, 2014 12:55 PM PST
I can convert these to dates using DATEVALUE((LEFT(F5,12))),
But I want to do this conversion on the fly when I am using this range as an argument for a countif function:
=COUNTIF(Dates!$F:$F,">"&DATE(1,1,2014))
:this obviously doesn't work since I have the date as text in that column
Let's say I converted these dates in another column G using DATEVALUE((LEFT(F5,12))),
=COUNTIF(Dates!$G:$G,">"&DATE(1,1,2014))
:Now this would work
But I want something like (which doesn't work)
=COUNTIF(DATEVALUE(LEFT(Dates!$F:$F,12)),">"&DATE(1,1,2014))
Is it possible at all?
The following will work:
=SUM(IF(DATEVALUE(LEFT(F:F,12)) > DATE(1,1,2014),1,0))
entered as a "array formula" (using ctrl-shift-enter).
You can't do that with COUNTIF because the first argument of COUNTIF must be a range (and using your DATEVALUE function will give an "array"). You can use SUMPRODUCT - I recommend restricting the range rather than using the whole column, e.g.
=SUMPRODUCT((DATEVALUE(LEFT(Dates!$F2:$F1000,12))>DATE(1,1,2014))+0)