I am having trouble filtering a column of times that used to work prior to today.
In column B1 was the format DD-MM-YY HH:MM:SS AM/PM so on column C1, I converted it into the format HH:MM:SS AM/PM and further pasted as value. I
autofilled till B1:B & lastrow, moved C:C to B:B and deleted column B:B as the purpose was served to get it converted to time only.
But later when I applied a filter on the time column B1 as shown below it does not give any results.
No code as yet as its just an Excel filter. I will write VBA if this works.
This filter should enable me to find the time cells ranging from specific time to specific time.
If you use TEXT, the result is text that looks like time. Time filters don't work on text.
Here is a simple way to extract just the time value, with INT to remove the date portion of the date/time. A true time is a number, to which you can apply time formatting.
Related
The format is not changing from mm/dd/year (e.g 08/28/18) to dd-mm-year (e.g 28-08-2018)
it is not updating, just staying the same.
please assist.
Your date is not currently being stored as a date value and is most likely text. You can test this out in several ways:
Select the cell and change the format to general. If is now shows a number then the date stored in the cell is numeric in value and we be subject to date change formats. If it remains as is then is is text.
Assuming the date is in cell A1, ISTEXT(A1). A TRUE result means its text.
Assuming the date is in cell A1, ISNUMBER(A1). A FALSE result means its text.
You can use the DATEVALUE function to convert TEXT dates to excel date values. however you need to be very aware of the date value you are starting with. This also is conditional with your system date settings.
A more generic and guaranteed method is to strip out the text for day, month, year, and toss them into the DATE function. Your life will be a bit easier since you have leading 0s. Assuming a date in cell B2 your formula could look like the following:
Day:
MID(B2,4,2)
Month:
LEFT(B2,2)
Year:
RIGHT(B2,2)
Now that you have striped out all the specific text as needed, drop the appropriate formula into the DATE function
DATE(YEAR,MONTH,DAY)
DATE(RIGHT(B2,2),LEFT(B2,2),MID(B2,4,2))
Apply custom formatting to the cell where the is located:
dd-mm-yyyy
I have two cells - one with a date and one with a time.
The date cell A1 is formatted as Cell Type Date MM/DD/YY.
The time cell B1 is formatted as Cell Type Time HH:00 AM/PM.
I am able to combine the cells using the formula TEXT(A1,"m/dd/yy ")&TEXT(B1,"h:mm AM/PM") with the result in cell C1.
For another program, I need to convert the date and time to Unix Epoch format and subtract the combined cell from 1/1/1970 (cell D1).
However, the formula (C1-D1)*86400 is not working. The formula gives a #VALUE error.
I understand the combined date and time has been converted to text so I set the cell format to the appropriate date and time format but that did not work either.
What's the appropriate procedure for performing this action?
Since dates are represented as integers and times are values between 0 and 1, you can combine column A and column B with simple addition and then format the cell appropriately.
Then do as you suggested and take the difference from that date to 1/1/1970 and multiply by 86,400 seconds in a day to get the Unix Epoch time.
Note: I accidentally put 886400 instead of 86400 in my screenshot. Please use the correct value.
I'd like to assign dates to cells in a planner spreadsheet I have made.
Currently, the rows are months, the columns are days of the week, and each individual cells just have a number for the day of the month.
I don't want to display the full date in the cell, just have the cell "know" what date it is representing. One use of this could be to have the current day always highlighted in a different colour when opening the spreadsheet. Is this possible in Excel?
Looking at your question, the results would require to show multiple "dates" within the cell.
For January '16 for example, you would have 4 different type of dates as January has 4 Mondays (4;11;18;25). Is this what you're looking to achieve? Otherwise it is not possible to have excel figure out a single date unless you provide it with additional references in order to come up with a result.
Enter a date into a cell. Format the cell to show the part of the date you want to see. In the screenshot, column A contains full dates in each cell. A2 and down are formatted with the custom format code shown in column C
Excel still treats the dates as the underlying full dates in formulas, even though only parts of the dates are showing in the cell.
I have around 20,000 records in an Excel file and around four columns which have dates. I am trying to insert those into SQL. However date columns have dates in incorrect format eg; 02/092015 or 02/90/2015 or 2015. So checking 20,000 records one by one would be very lengthy.
I tried to count / but it didn't work. It changes the format of column to date.
I was looking for some formula which can check the format and maybe color the cell or something like it.
I was running across this issue today, and would like to add on to what nekomatic started.
Before we begin, the TEXT formula needs to follow the date format we are working with. If your dates are in month/day/year format, then your second argument for the TEXT formula would be "mm/dd/yyyy". If it is in the format day/month/year, then the formula would need to use "dd/mm/yyyy". For the purposes of my answer here, I am going to have my dates in month/day/year format.
Now, let's assume that cell A1 contains the value 12/1/2015, cell A2 contains the value monkey, and cell A3 contains the value 2015. Further, let's assume our minimum acceptable date is December 1st, 2000.
In column B, we will enter the formula
=IF(ISERROR(DATEVALUE(TEXT(A1,"mm/dd/yyyy"))),"not a date",IF(A1 >=DATEVALUE(TEXT("01/01/2000","mm/dd/yyyy")),A1,"not a valid date"))
The above formula will validate correct dates, test against non-date values, incomplete dates, and date values outside of an acceptable minimal value.
Our results in column B should then show 12/1/2015, not a date, and not a valid date.
Two of the examples you give are text which may be identified with Conditional Formatting by applying a formula rule such as:
=ISTEXT(A1)
and colouring the result as you wish. There would be an issue if all your dates (even those of valid format) are also text but I'm guessing that is not the case.
For the third example (ie 2015) a CF formula rule such as:
=AND(A1<2500,A1>0)
may help.
If your columns are a mixture of what should be dates and other entries that are properly text strings your approach may be better than the more general ISTEXT, for example a CF formula rule of:
=FIND("/",A1)>0
If you can add a column to the Excel sheet with the formula
=DATEVALUE(TEXT(A1,"dd/mm/yyyy"))
this should return #VALUE if the contents of A1 are not a valid date in dd/mm/yyyy format. You can filter on this value to identify the incorrect records.
Edit: If A1 contains only 2015 this formula returns 07/07/1905 (if the formula cell is formatted as date) so you can spot these by filtering for dates before the earliest correct date your file should contain.
How to represent date and time in one excel cell?
There are cell formats such as date and time. But there
is no one format that includes both date and time.
How should I write both date and time in one cell then?
What I had to do is to split the date and time in two
separate cells like this:
Edit: This picture shows how I get a date and the incorrect result I get.
If you enter:
=NOW()
in a cell and format the cell as Custom
dd/mm/yyyy hh:mm:ss
You should get what you want.