Excel DATE IF Condition - excel

Excel formula required as per the following conditions:
Conditions:
After Date after 31/07/2017
Before Date after 12/10/2016 & Before 01/08/2017
Old Date after 12/10/2015 & Before 12/10/2016
Very Old Date Before 12/10/2015
Output as follows
Date Status
12-03-2014 Very Old
10-03-2015 Very Old
11-02-2016 Old
05-05-2016 Old
22-12-2016 Before
25-01-2017 Before
28-02-2017 Before
20-03-2017 Before
19-06-2017 Before
20-07-2017 Before
21-07-2017 Before
10-08-2017 After
25-08-2017 After
29-08-2017 After
01-09-2017 After
08-09-2017 After
Please help
CSGanesh

Create a table with the start dates and the expected outcome:
Then use VLOOKUP()
=VLOOKUP(D2,A:B,2,TRUE)
If you do not want to use a table but want hard-coded formula then:
=CHOOSE(MATCH(D2,{0,42289,42655,42947}),"Very Old","Old","Before","After")
{0,42289,42655,42947} are the dates in general format and can be replaced with the actual dates in quotes; {"1/0/1900","12/10/2015",...}

I would use a nested if statment here is a link:
https://exceljet.net/formula/nested-if-function-example
here are the first two conditions, excel can interpret time intervals so lock a cell with the conditions and then drag the formula. Remember to verify that the cell is indeed a date.
IF(date<12/10/15,"Very old",IF(AND(D6>12/10/15,date<12/10/16),"old",0))

Related

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 Dynamic Spreadsheet

I have a dynamic Spreadsheet with these columns.
Subject | ID | Status | Assigned To | Created By | Created On | Date Closed
I am trying to create a formula that can count:
Count all where status=Completed and Date is this year.
Count all records that were created today
I tried multiple formulas but I am not sure why its not working, I am not able to filter properly to get the correct records. Any help would be beneficial.
I tried =COUNTIFS(B:B, "Completed", H:H, ">=01/01/2018") But this did not filter the record.It still includes records from previous years.
I also tried two separate count if statements. Those those did not seem to work either.
Your formula seems fine. Just check and make sure the date format is correct. You can also add a separate column for year (you can use year function) and write =COUNTIFS(B:B, "Completed", I:I, 2018). (I guess your code doesn't run because Excel considers your given date as text and not a true date!
If you are sure that your H:H is a date format but not text, you may try to use the integer equivalent of 01/01/2018 in yor formula, which is 43101. So your formula would be:
=COUNTIFS(B:B, "Completed", H:H, ">=" & 43101)
Or you may write your limit date to a cell and may directly reference that cell in your formula:
=COUNTIFS(B:B, "Completed", H:H, ">=" & E7)

Excel Return Date before another date by another column name

I have two sheets of data with the following.
I want return the date from sheet 2 on sheet 1 with the start date BEFORE the remove date. For example. For Customer A, the remove date is 12/29/2016. I would want to return the date of 12/20/2014 from sheet 2 as it is the next previous date from the remove date of 12/29/2016 from sheet 1 and is removed prior to the third date of 1/20/2017. Similarly for Customer B, the date returned would be 11/9/2013.
Vlookup will not work as there are more than one unique value for customer and I had no luck with index and match. Is there any other possible solution?
Here is an edit. The Sumproduct and aggregate method for the start date works great. The issue is I need the last date to be the first record after the replacement date. So in this case, it would be 2/1/16. Using the Min or Max sumproduct and aggregate method, I get either 0 or the max date of 3/22/17, which is not what I want.
Since dates are (for all intents and purposes) numbers, this is really nothing more than a pseudo-MAXIFS question. Try,
=aggregate(14, 6, (b2:b7)/((a2:a7="A")*(b2:B7<date(2016, 12, 29))), 1)
For those that don't have the latest version of excel and can't use maxifs, we can do an array formula: take the max date that is less than the date corresponding to A
=SUMPRODUCT(MAX((A9:A14=A3)*(IF((B9:B14)<B3,B9:B14))))
entered as array formulae (Ctrl+Shift+Enter)

Excel: Check cell for date

Short story short:
I want to check the cell C21 if it contains a date. I can't use VB cause it's deactivated by GPO.
Used this from this page
D21 contains this:
=WENN(ISTZAHL(DATWERT(C21));"date";"no date")
in english
=IF(ISNUMBER(DATEVALUE(C21))...
C21 this:
=HEUTE() # in english: =TODAY() Maybe other dates later, but allways in the correct format
but it allways returns "no date"
Use this: =IF(LEFT(CELL("format",C21))="D",..,..). Learn more about CELL formula here.
In your example =TODAY() already a real date and not a date stored as text, so doesn't make too much sense to use DATEVALUE there.
Update
Here are some example dates and how CELL recognize them:
format value output
dd/mmmm/yyyy 12/June/2015 D1
dd/mm/yyyy 12/06/2015 D1
yyyy 2015 G
general 2015 G
dd/mm 12/06 D2
mmmm June G
dd mmmm yyyy 12 June 2015 G
Note: CELL is not volatile, so if the format of source cell is changed it won't be refreshed automatically, you need to either recalculate your sheet / book, either open the formula and press enter (also automatice recalculation initiated by any other volatile formula will cause it to refresh).
Use this formula, the expression will return TRUE if cell A1 contains an invalid date.
=ISERROR(DATE(DAY(A1),MONTH(A1),YEAR(A1)))
This formula works by evaluating each component part of the date: DAY, MONTH and YEAR and then aggregating them using the DATE function.
ISERROR will the catch any errors by returning TRUE (invalid) otherwise FALSE (valid).
Obviously the date value in cell (A1) must contain values >= 01/01/1900.
Useful for "Conditional Formatting".
Excel stores dates as numbers. 1 is 1-Jan-1900.
When it comes to numbers in a cell, Excel cannot tell if a number is meant to be a number or a date.
Today is 11/06/2015 as a date and 42166 as a number. For the consumer of a spreadsheet, the cell can be formatted to display the number as any number format or as a date. Excel formulas cannot tell whether the number in that cell is "meant" to be a date.
So, there is no Excel formula that you can use in a spreadsheet that will tell you if cell A1 is about 42166 widgets or if contains the date of June-11-2015.
Some of provided answers, checks cell format, which will not considers cell value, as you can format differently each cell no matter of its content, for checking if a cell value is date you can use this:
if(ISERROR(VALUE(c21)),"No Date", ----do staff for Date ----)
or shorter version which just will inform you "no date" status. If a date entry is find, it will return its numerical value instead:
IFERROR(VALUE(c21),"No Date")
hope this helps,
Cheers,
M
use the following formula ...
=IF(NOT(ISERROR(DATEVALUE(TEXT(C21,"mm/dd/yyyy")))),"valid date","invalid date")
I think it will solve your problem.
If the value is a string this method would work.
TEXT(DATE(VALUE(RIGHT(AI8,4)),VALUE(MID(TRIM(AI8),4,2)),VALUE(LEFT(AI8,2))),"dd.mm.yyyy") = AI8
Just wanted to add to the discussion that although you can check with a date(year;month;day) it will give you false positives, since the way it works is that it seems to just roll over values that exceed the logical limit, i.e. if you have the date 99-12-35 it will assume that you meant to write Jan 4th 2000, since that is the 35 - the 31 days of December. In other words, you will find some errors, but not all. Same goes for months exceeding 12.
try this formula (depends on date format):
=IF(DATE(TEXT(C21;"yyyy");TEXT(C21;"mm");TEXT(C21;"dd"));"contains date";"doesn't")
I tried every solution posted but none of them work if there are empty cells in the date cells, so I added a check to GBGOLC's answer and now it works with empty cells:
=IF(NOT(OR(ISBLANK(C21),ISERR(DATE(DAY(C21),MONTH(C21),YEAR(C21))))),"Yes it is a date","Not a date")

Excel convert date to text retaining date layout

I have rows containing every Monday and Sunday in an entire year, (with variations on when a month starts and ends) like so,
11/05/2015 18/05/2015 25/05/2015 01/06/2015 08/06/2015
17/05/2015 24/05/2015 31/05/2015 07/06/2015 14/06/2015
However these are in the date format, and I need them in a text format, but so they still read in the dd/mm/yyyy format, not like 42125.
Further up my document, each column header should read dd/mm/yyyy-dd/mm/yyyy using each of the dates shown in my first example, and I was hoping to achieve this using the formula =A30&"-"&A31 and so on. So the desired outcome should read,
11/05/2015-17/05/2015 18/05/2015-24/05/2015
11/05/2015 18/05/2015
17/05/2015 24/05/2015
However using the =cell&cell formula im left with
42135-42141 42142-42148
11/05/2015 18/05/2015
17/05/2015 24/05/2015
I have to create these headings for 2 years worth of dates, and trying to avoid typing every heading out manually, is there a way to achieve this?
Use the TEXT function which comes with Excel.
Assuming cell A1 has "11/05/2015", use the following formula in cell B1:
B1=TEXT(A1,"dd/mm/yyyy")
This takes care of the first part of your question. For the second part, you can use the CONCATENATE function. Assuming that B1 and B2 contain dates as text, you can join them together using the following formula:
=CONCATENATE(B1, "-", B2)
Try converting those values to text before concatenating:
=TEXT(A1,"dd/mm/yyyy")&"-"&TEXT(A2,"dd/mm/yyyy")
You need to break them down like so:
=DAY(A3)&"/"&MONTH(A3)&"/"&YEAR(A3)&"-"&DAY(A4)&"/"&MONTH(A4)&"/"&YEAR(A4)
I am assuming here your data start from cell A3
Assuming headings in row 1 and dates in rows 3 and 4 this will work:
=TEXT(A3,"dd/mm/yyyy")&TEXT(A4," - dd/mm/yyyy")
without having to concatenate " - "

Resources