Solved

Excel User Function to Calculate Date Minus One Year

Posted on 2015-01-06
8
142 Views
Last Modified: 2015-01-07
I am looking for a custom function for Excel 2010 that will take a date such as 5/25/2015 and turn it into 5/25/2014. I am entering dates of receipts for 2014.  When I enter 5/25 it defaults to 2015 when I want to be 2014.
0
Comment
Question by:Alex972
8 Comments
 
LVL 47

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 40534845
You can use this formula...

    =DATE(YEAR(A1)-1, MONTH(A1), DAY(A1))

...where cell A1 contains the date.
0
 
LVL 12

Expert Comment

by:Alan3285
ID: 40534850
Hi,

If you enter a date with only the day / month, excel assumes you mean the current year.

One way to make it use 2014 instead, is to just adjust your computer clock to a year ago while you are doing the data entry, and then change it back again after.

Alan.
0
 
LVL 18

Accepted Solution

by:
krishnakrkc earned 500 total points
ID: 40534863
Or you can use this formula as well.

=EDATE(A1,-12)

Kris
0
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

 
LVL 33

Expert Comment

by:Rob Henson
ID: 40535424
Expanding on Alan's comment, Excel assumes current year so for entries where you know it is prior year ensure you enter the year as well, ie 5/25/14.

Thanks
Rob H
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 40535681
If you have a range of date values which all have the year 2015 but you need them to be 2014 then a quick way to change them all without formulas is as follows:

put 365 in any blank cell and copy that cell
select range of dates to convert then "right-click" and choose "Paste Special" from menu and in the dialog box under "operation" choose "subtract"
Choose "OK" then press "Esc" key

You may need to reformat the dates in your required date format

regards, barry
0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 40535748
Or do a Find & Replace for 2015 replacing with 2014.
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 40535780
Hey Rob,

Nice one - I didn't know that would work with real dates, assumed it would only work with text values

Learn something every day........

regards, barry
0
 
LVL 1

Author Closing Comment

by:Alex972
ID: 40536385
Works well in my test and I like it that is short as well as dynamic.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Web Query 1 19
populate  some cells after data verification 45 18
Records from Access to Excel to specific cells 5 22
Clear a Text Box 7 23
A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question