Copy Excel formula itself to clipboard

1

There are many questions about copying values instead of formulas, but what I am seeking is exactly the opposite. I want copy the formula itself, not the result of its calculation from some cell, and not the copied formula with adjusted cell addresses.

A picture worth a thousand words. On this picture I outlined the desired value

enter image description here

What I want to have in my clipboard and paste into D6 is not 629bb706a18c16ad87640f253a745841, not the next generated GUID, but exactly this string:

=LOWER(CONCATENATE(DEC2HEX(RANDBETWEEN(0,4294967295),8), DEC2HEX(RANDBETWEEN(0,42949),4)...

Is there any way to copy it directly being positioned on cell, without putting cursor to formula bar? Is there any hotkey for this?

I am not seeking programming solutions, but AHK-based ones are okay.

Suncatcher

Posted 2018-01-13T12:46:22.967

Reputation: 908

Copy the Cell, and Right Click and hover on Paste, and you should see Paste Formula? – Darius – 2018-01-13T13:01:19.800

Yes, I see it. But when I press "Paste formula", again, it pastes the next generated value, i.e. already evaluated/calculated result, not formula itself. – Suncatcher – 2018-01-13T13:06:06.497

Wait.. let me confirm whether you wanted to see the "result" of the formula on the cell? (and the Formula itself on the Function Field) - or you wanted to paste the actual Formula into the Cell? – Darius – 2018-01-13T13:10:45.347

No, I want formula expression that is seen in function field. I clearly showed what I want on the screenshot (marked by red square). – Suncatcher – 2018-01-13T13:12:53.900

I'm not familiar with AHK, but without moving your mouse over to the function key, you can copy and paste into a new cell, press F2, Home, and then put a ' (single quote) at the beginning of the function which will treat the formula as text and will display exactly that. So if you are familiar with AHK, you can probably script AHK to do exactly that (after you paste, F2, Home, ', enter) ? Edit: Sorry I just re-read your title and you wanted the formula into the clipboard? Then F2, Ctrl A, Ctrl C - and it is in the clipboard - possible in AHK maybe - not too familiar with it. – Darius – 2018-01-13T13:16:09.420

Answers

3

In the ribbon select Formulas tab and then Show formulas.

Instead of values you will see in all cells directly formulas, so you may copy/paste them as you wish.

MarianD

Posted 2018-01-13T12:46:22.967

Reputation: 2 572

Cool, this seems to be the most relevant answer. Is there a hotkey for enabling this view? – Suncatcher – 2018-01-14T16:03:29.323

No other than pressing the ALT key and then follow pressing appropriate letter keys (displayed by pressing that key). (You may use AutoHotKeys for it.) – MarianD – 2018-01-14T16:12:12.917

1I was not correct - there IS other hotkey: Ctrl + ` (grave accent) - or, if it does't work - Ctrl + , (comma). – MarianD – 2018-01-25T12:21:19.350

1

There is no way to do it directly with a single hot-key.
However, you can avoid the explicit clicking by using the sequence F2 CTRL+A CTRL+C. The formula bar does not even need to be visble for that (but it still uses it)

Aganju

Posted 2018-01-13T12:46:22.967

Reputation: 9 103

That seems acceptable, but! But Ctrl-A doesn't work for me after F2. I can select formula only manually with Shift + Arrows, which is a mess. – Suncatcher – 2018-01-14T15:21:03.937

F2 then ctrl+shift+home then ctrl+c – Alex M – 2019-02-06T01:45:19.347