I am not sure if I am just over looking something, because I am still a very newbie to Excel's functions, so here comes the problem :
Lets say that I have A1 cell, and I want to display todays date in another cell whenever the A1 cell isn't empty.
So I came with this :
in another cell :
IF(A1<>"";TODAY();"")
Todays date is 16.8.2015, but when I run TODAY() through a condition like this, the output is : 42232
Why would I get this weird number ?
Maybe I did syntax wrong ? Not sure.. I also tried to make =TODAY() in new cell, that displayed the 16.8.2015, and then I wanted to show that cell through that condition, it threw the "42232" again.
Be sure that the cell format is Date and not General or Number.
The TODAY function returns a serial number which is equivalent to the amount of days since 1/1/1900. That is why you are seeing the number instead of the date.
Select the cell with the number and on the Home tab you can change the format to Date (See Below).
Every date in Excel is represented by a number. For example, the number 1 represents 1/1/1900. Whereas 42232 represents 8/16/2015.
Related
How do I separate date and time from this 2006-09-02T01:07:59.100 I’ve tried =int(A2) but it gives a value error. Please help.
in the column for Date put this formula: =left(A2,10), for the time: =right(A2,12)
Not sure what your purpose is. Display date and time separately or actually have two different values in different cells.
Excel does not play nice with "T" in the middle of the timestamp. You must remove "T" using a string function. Once you have done that your value will format nicely as a date. INT works for the date part, MOD works for time, format cells accordingly.
If display is the only requirement, put the same value in both cells and use cell formatting -- one for Date, one for Time.
I know this is a simple question, but, what I mean is how do you copy a cell, but when that cell changes, it doesn't affect the copy.
To make it a bit easier to understand, If I had A1 that said "Hi", and I wanted A2to say "Hi" also, I would put =A1. However, if I changed A1, it would change A2 along with it, and that is what I don't want.
I am asking this as I have a formula that says that something is so and so weeks overdue, but when a checkbox is ticked, the weeks counter stops and doesn't add any more.
Here is what I mean and the paragraph underneath states what it means and what I need from it.
The cell that says "13/02/2019" is =TODAY() and the cell that says "06/02/2019" is a date I manually entered. The problem I have is that if I came back in 1 week, it would say "Handed in late by 2 weeks." and that is what I want to prevent. However, I only want this =TODAY() to freeze when that check box is ticked.
Today() reports today's date and it will always update to the current date. Today() is a volatile function that will recalculate on every worksheet change, even cells entirely unrelated to the function. Formulas referencing a cell containing Today() will also update to reflect the current date like you are experiencing now.
You appear to be looking for a process that will snapshot the date at the time of an action (checking a box). If you want it to be a formula, you will need to input the date of return as well and create a formula comparing the difference between to two inputs. There is already a shortcut to insert today's date in a non-formula method: Select the cell and press Control + ; (semi-colon). A simple formula that references the difference between the check-out and check-in dates on a per line basis with rounding and concatenate functions, should accomplish the described purpose.
A1 = (Checkout date)
B1 = (Return Date)
C1 =IF(ROUNDUP((B1-A1)/7,0)=1,CONCATENATE(ROUNDUP((B1-A1)/7,0)," Week"),CONCATENATE(ROUNDUP((B1-A1)/7,0)," Weeks"))
This function checks the difference between A and B, divides by 7 to get number of weeks, rounds it up to a whole number, and checks if the number of weeks is 1 or not. If it is one the text will say " week" otherwise it will say " weeks". This also avoids using a volatile function which in larger projects would cause incessant and potentially resource demanding calculating.
My spreadsheet is to show me how many days active a certain field has been.
For this I am trying to find a formula which will automatically take the entered date from one cell and deduct it from "todays" date.
As an example I have used =DATEVALUE("22/04/2017")-TODAY() - and although this works, i am unable to drag the formula down into other cells, to auto populate when a date has been entered/ amended. I'm having to enter the formula above every time, and if the date changes, as an example from the 22/04/2017 to the 20/04/2017, I would have to manually amend the formula too. How can I get it just pick up the date in that particular cell and deduct "today" from it?
Sorry if i'm rambling, I just don't know if I'm explaining myself properly.
Thank you
Typically, 'how many days active a certain field has been' would be a positive number (i.e. the number of days). Reverse the subtrahend and minuend to get a positive integer like this,
=today()-a3
To avoid getting 5/15/2017 or 42,870 as the result when A3 is blank, check to see if there is something in A3 before attempting subtraction.
=if(len(a3), today()-a3, text(,))
I'm trying to calculate the time between the dates , at the beginning the formula
was working fine but I've noticed that it does not work when the date is different
For example , I have the following information on cell A1: 09/15/2016 10:00 AM
On Cell B2 I have: 09/16/2016 10:00 AM
The formula is just B2-A1 but instead of giving me a result of 24 hours is just giving me 0 . I believe the formula is not recognizing that these are 2 different days and is just doing 10-10
Any idea how to fix this ?
I was able to get the result 24 by setting a custom format of [h] (you will have to type it into the 'Type:' box) on cell C1 while using the formula =B1-A1
Excel Reference
'Format Cells' view
The problem with just using =B1-A1 is that if either or both of those cells is not populated then you will get weird numbers in C1. You may want to make C1 display as a blank cell unless both boxes are populated, try something like this =IF(OR(ISBLANK(A1),ISBLANK(B1)),"",B1-A1)
The reason for the weird numbers is that Excel calculates time based on a predefined decimal system that indexes time starting at like 1/1/1900 or something like that. So when manipulating or calculating time, that is something that you always have to keep in the back of your mind.
Hope this helps.
Formation the destination cell to will do but since you have date and time combined it will show as 1 calendar day difference 0 only means that 12 am after the 1 day difference, I know it does not make any sense but its Excel...
If I was you, on column A, I would add the date, and on Column B, the time.
then just work with the time, as both combined can be tricky
Don't forget to format your cells!! (right click>Format Cells>Time>3/14/12 1:30 PM)
In cell A2 I have 7/21/2014 12:44:36 PM
When I use DATEVALUE(LEFT(A2;FIND(" ";A2)-1)) I get the error #VALUE.
When I use LEFT(A2;FIND(" ";A2)-1) I get 7/21/2014.
What do I need do that function DATEVALUE(LEFT(A2;FIND(" ";A2)-1)) to return just the date?
DATEVALUE() is designed to make a Date out of plain text. Your cell is currently a Date/Time, which is a numeric value. I recommend using one of the following solutions to get the date from the cell.
Using DATE()
This is the cleanest option and the method that I would recommend.
=DATE(YEAR(A2),MONTH(A2),DAY(A2))
YEAR() gets the Year value from the cell, MONTH() gets the Month value, and DAY() gets the Day value. The DATE() function takes a Year, Month, and Day value, so by passing them into DATE() we can get the Date value from A2.
Using INT()
If we look at the numeric value of your Date in A2, we see that it is 41841.5309722222. The whole portion of the number (41841.) is the date and the decimal portion (.5309722222) is the time. So if we take INT(A2) to convert this value to an integer, we will lose the decimal portion so that all that remains (41841) is the date. So this is our formula for using INT()
=INT(A2)
The same idea can be accomplished with ROUNDDOWN(A2,0) or =FLOOR.MATH(A2) or =FLOOR(A2,1).
Using DATEVALUE()
While the first solution is the cleanest, there is a way to do this with DATEVALUE() that involves converting the cell into Text first. The TEXT() function takes a value and a format string, so we format the cell value as Text as follows
=TEXT(A2,"yyyy-mm-dd")
And this gives us
2014-07-21
We then pass that result into DATEVALUE()
=DATEVALUE(TEXT(A2,"yyyy-mm-dd"))
You will need to format the result as a date.
Using LEFT() and DATEVALUE()
Based on this Stackoverflow question that I found, it appears the issue could be a result of inconsistent formatting, so you might try this solution
=DATEVALUE(LEFT(A2,FIND(" ",A2)-1))
I have included my results with this and the other methods in a screenshot below. You can see by my use of the TYPE() command below the value that I tested this on both a number and text.
Results
Formatting
I'm assuming you want just the date for calculation purposes, but if you just want to display the date, you can format the cell to only show the date and ignore the time element although the time element will still be present in the cell. I'm assuming you know about this, but since you didn't specify, it is a possible solution.
Please try:
=INT(A2)
and format the result to suit.
In a comment I have just seen you mention "=INT(A2) return #VALUE!" so I would suggest selecting your date cells, DATA > Data Tools, - Text to Columns, Delimited, Delimiters Tab (only), and at Step 3 of 3 choose MDY for Date: or change your locale to say USA.
If neither work try =INT(TRIM(A2)) in case you have leading spaces (though not showing them).
If still not working, try applying =CLEAN.
If still nothing works then some further details of where your dates are coming from and how imported would be helpful, and of your locale and default date format.
Date macros are depending on the system date format and based on configured system date format the macros can fail to work. Try below solution. We faced similar issue after open excel file sent by me on another laptop where system date/time format was different. On destination laptop formulas using date functions started giving error. After following below steps errors disappeared.
Left click on bottom right portion of task bar where time is displayed
Click on date and time settings
Click on change date and time
Change calendar settings
Click on reset to go back to original values
Click on OK on all opened dialogues
Now excel formula error should disappear
SIMPLE SOLUTION - I found a solve that worked very well:
=DATEVALUE(TEXT([CELL],"MM/DD/YYYY")
Effectively this lets me convert any value into text, then back into date. It fixed my Datevalue error and I can use it regardless of the original cell formatting.