Hey, a REAL magician never reveals how it's done!

Pilot fish has coded a large Excel macro for one of his company's unit managers -- and it's been running without problems for years.

"The macro reads a raw data file, extracts and manipulates a bunch of the data in the file, and then creates a summary report and a detailed report of the data," says fish.

"But last week that manager let me know that the format of the data file is changing, so the data will be in different columns than they are now. He wanted to give me a heads-up, since the reports that are created won't be accurate, given this new raw file format."

You'll be fine, fish tells him. Just run the macro as you normally do.

Manager is not convinced, and complains to fish that the raw data file won't look the same at all. But the following week he does as instructed and runs the macro.

And sure enough, even with the new file format, the summary and detailed reports are perfect.

"How did you do that?" he asks fish. "I can't believe it still works!"

But fish can -- mainly because the data file format has already changed several times over the past few years.

"Long ago, after a different data file's format kept changing, I made it a point to code all future macros with a simple little routine to specifically look for the headers in the file, whatever column they may be in," fish says.

"That way, if new columns are inserted anywhere, the macro searches for and finds the header it's looking for, and thus knows what column that data is in. The manager wasn't aware of it, because the well-written macro ran as designed."

Got magic? Tell Sharky about it. Send me your true tale of IT life at sharky@computerworld.com. You'll score a sharp Shark shirt if I use it. Comment on today's tale at Sharky's Google+ community, and read thousands of great old tales in the Sharkives.

Get your daily dose of out-takes from the IT Theater of the Absurd delivered directly to your Inbox. Subscribe now to the Daily Shark Newsletter.

Related:
How to protect Windows 10 PCs from ransomware
Shop Tech Products at Amazon