Re: Excel change by 1 month
Re: Excel change by 1 month
- Subject: Re: Excel change by 1 month
- From: Paul Berkowitz <email@hidden>
- Date: Mon, 15 Dec 2008 11:00:46 -0800
- Thread-topic: Excel change by 1 month
On 12/15/08 8:31 AM, "Doug McNutt" <email@hidden> wrote:
> This is what I use in Excel. It returns one month from the cell
> immediately above while handling all of the special cases. The
> formula was copied from cell C45.
>
> =DATE(YEAR(OFFSET(C45,-1,0)),MONTH(OFFSET(C45,-1,0))+1,DAY(OFFSET(C45,-1,0)))
Yes, using a built-in Excel function in an unused cell and getting its
value (or do it right in the cells concerned) is the other way to go, and
sometimes it can be a lot faster too. (In this particular case, the
AppleScript solution was very fast.) It ensures that things will always be
done the "Excel" way for special cases.
Excel functions are not AppleScriptable as they are in VBA (apparently this
had to do with incompatibility of floating point precision, which is better
in Excel than in AppleScript). But you can always just enter a function in a
cell by script, as you would in the UI, and get the result, as you did here.
I just tend to be more familiar myself with AppleScript than with Excel
functions, so if it's easy enough I do it the AS way. But going the Excel
way is actually smarter for avoiding unknown differences between Excel and
AS conventions.
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden