Google-sheets – Google Sheets: Supplement cells automatically

google sheetsgoogle-sheets-macro

My goal is a function/macro/script that automatically inserts a text in every selected cell by a key combination (or similar). The inserted text needs to stand at the beginning as seen in the example below.

Cells A1,A2,A3…..,A10

A1: open

A2: open

A3: Closed

A4: open 5. August

A5: Closed

A6: Closed

A7: open 8. April

A8: open

A9: open 14. April

A10: Closed

I would like to select cells A3-A7 and then use a keyboard shortcut (or similar) to supplement the contents of the cells with date and shortname (in this case: 17.11.20 hl). This will then result in:

Cells A1,A2,A3…..,A10

A1: open

A2: open

A3: 17.11.20 hl Closed

A4: 17.11.20 hl open 5. August

A5: 17.11.20 hl Closed

A6: 17.11.20 hl Closed

A7: 17.11.20 hl open 8. April

A8: open

A9: open 14. April

A10: Closed

I appreaciate any help. Thanks a lot.

Best
Luca

Best Answer

I cannot see a particular pattern that an algorithm could use to find what you want to insert into what, so here's one way you could do it:

Data in cell A3: [Closed]

In an adjacent cell, say, B3, type [="17.11.20 hl "&A3]

Copy and paste (or drag) this from cells A3 to A7

Your 'keyboard shortcuts' will then be Ctrl+C and Ctrl+V ;-)