August 15, 2014 at 12:07 AM by Dr. Drang
When Apple revived the iWork apps after their four-year coma, users soon found that the newly awakened versions were diminished. Some of the features that were cut have been brought back, but the ability to define named constants in Numbers—which I used in my expense report template—has not reappeared. I’ve learned, though, that I can use TextExpander instead, and I now have a few simple snippets that are even easier to use than named constants.
I use the snippets to enter mileage expenses when I drive my car on business. The IRS rate changes from year to year—currently it’s 56¢ per mile—and I hate having to look it up. As I said, I used to have a constant, named
miles, defined in my expense report template to equal the current rate. To enter the mileage expense for a 25-mile trip, for example, I’d type
into the cell and it would do the substitution and the calculation. Simple, but no longer possible. I suppose I could set up a cell in a hidden part of the expenses table and get the same effect, but I don’t like hidden cells. It’s too easy to make mistakes when you can’t see everything.
I set up an Expenses folder in TextExpander. The snippets within it expand after any character and work only in Numbers.
The fundamental snippet in the group is for the mileage rate. You might think I could just define it as 0.56, and that’s what I tried first, but I soon found that Numbers does some odd things with typed input. When I tested the snippet by typing
into a cell, I heard the TextExpander expansion sound, and the
;mi disappeared, but nothing was substituted in its place. After a bit of tinkering, I found that a snippet with the content
=0.56* would always expand, so that’s what I used.
Now I type
;mi into a cell, it expands to
=0.56*, and I type the number of miles as the second term of the multiplication instead of the first. It’s a little different from my old habit, but it was easy to get used to.
Trips to the airport are pretty common, so I defined two other snippets, one for the trip to Midway and another for the trip to O’Hare. They start by invoking the mileage rate snippet and then add the number of miles to the end. If the mileage rate changes next year, I only have to change one snippet.
I have a tendency to think in terms of complicated AppleScript or shell script snippets, but it’s often the simplest snippets that are the most useful.
In fact, as I was typing this up, I realized that snippets for the tolls I pay on my way to and from the airports would be just as valuable. I’ll be making those as soon as this is published.