What does the formula =cmd|'/C calc'!A0 do in Excel and why?

In excel 2013, on Windows 7 you can create a formula which looks like this...

=cmd|'/C calc'!A0

When you hit enter you'll get a security warning. If you ok that then you'll see that the windows calculator runs.

I believe this works for quite a few versions of excel.

It seems that cmd is running with the command line arguments /C calc, which makes the calculator run, without opening a cmd shell.

But what is the !A0 doing?

3

1 Answer

I think what's happening is the ! does what it always does - tells excel that it's looking for something that's not on this sheet.

Usually it would be expecting a cell reference in whatever location is referenced before the !, but here, once it escapes the sheet, it goes into the file system to find the referenced workbook. And since the reference isn't the path to an excel workbook, but a command line instruction, it executes that instead and never gets to needing the cell reference after the !.

So, the A0 is completely arbitrary - I've changed it to =cmd|' /C calc'!notthissheet and =cmd|' /C calc'!xxx and it will still work.

(this is in excel 2016)

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like