The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,152 other subscribers

Archive for the ‘Excel’ Category

Excel for MacOS seems to have no post-paste shortcut to modify the paste options

Posted by jpluimers on 2023/02/24

Excel on Windows has a neat trick where you can press the Ctrl key after a paste operation.

This lets you determine after pasting if you want to change the [Wayback/Archive] Paste options in a similar way “Paste Special” will modify this while pasting as shown for instance at [Archive] What is the Excel keyboard shortcut for ‘paste special’? – Quora (excluded from the WayBack machine)

  1. Copy your source (Ctrl + C)
  2. Press Ctrl + V – Pastes as usual
  3. Press Ctrl – Paste options get displayed
  4. Press ‘P’ for paste special /‘V’ for values/’F’ for formulas etc

and [Wayback/Archive] Shortcut in Word or Excel for Special Paste?

Word 2013:

After having copied something go where you want to paste it (without pasting the format). CTRL+V (it will temporarily paste the format too) then CTRL (push and release the control key) then T (the last T means “keep text only”).

Excel 2013:

After having copied something go where you want to paste it (without pasting the format). CTRL+V (it will temporarily paste the format too) then CTRL (push and release the control key) then V (the last V means “paste Values”).
It’s important that the second CTRL key is released before typing the last letter.
This method requires just 4 keyboard hits, no macros and no use of the mouse in a dialog window.

The cool thing about this feature is that you can visually see the original paste, then determine how you want to modify it.

On MacOS, there is the post-paste glyph you can click, but no keyboard shortcut.

Basically, here are three ways I now work on MacOS while pasting:

  • When I really want to paste all properties on the ckipboard:
    • CommandV: Paste
  • When I want to decide which properties to copy:
    • CtrlCommandV: Paste Special
  • When I want just text:
    • CtrlU, CommandV: Edit cell, Paste

On MacOS, CtrlU is the equivalent of F2 on Windows (similarly, CommandT is the equivalent of F4) and brings the cell into edit mode before pasting. The mouse-equivalent is double clicking the cell before pasting.

I got that CtrlU / F2 trick from [Wayback/Archive] Always Match Destination Formatting | PCMag via [Wayback/Archive] Excel copy-paste: always match destination formatting – Super User.

Related

All based on [Wayback/Archive] macos excel “paste options” shortcut – Google Search

–jeroen

Posted in Excel, Office, Power User | Leave a Comment »

Day of the Year in Microsoft Excel

Posted by jpluimers on 2023/01/25

Given cell A1 is a valid date, I wanted to know the day of that date in that year.

My solution is =A1-DATE(YEAR(A1)-1,12,13)

I disliked the solution in [Wayback/Archive] Day of the Year in Microsoft Excel and [Archive] Day of the Year in Excel (In Easy Steps) (excluded from the WayBack machine), as it is unclear where the + comes from in their solution =A1-DATE(YEAR(A1),1,1)+1

So, here goes my solution, with explanation:

  • =YEAR(A1) is the year of A1
  • =YEAR(A1)-1 is year before A1
  • =DATE(YEAR(A1)-1,12,13) is the last day of year before A1
  • =A1-DATE(YEAR(A1)-1,12,13) is the day of the year of A1

The last step works because subtracting two dates in Excel returns the number of days between those two dates (in a similar way, you can add a number to a date to get a new date number days in the future; similarly you can add time portions as fractions of a day).

The linked solution uses:

  • =YEAR(A1) is the year of A1
  • =DATE(YEAR(A1),1,1) is the first day of the year of A1
  • =DATE(YEAR(A1),1,1)-1 is the last day of the year before A1
  • =A1-(DATE(YEAR(A1),1,1)-1) is the day of the year of A1
  • =A1-DATE(YEAR(A1),1,1)+1 is a simplification of the day of the the year of A1

[Wayback/Archive] excel days from start of year – Google Search

–jeroen

Posted in Excel, Office, Power User | Leave a Comment »

View multiple panes, sheets, or workbooks – Excel for Mac

Posted by jpluimers on 2022/03/31

Usually, I work in a single worsheet and workbook at a time.

Sometimes I use multiple worksheets or workbooks, and I never knew about the below feature.

The really cool aspect which is not in the below documentation: if you re-open a worksheet, it remembers the views and positions!

Learned a new thing and discovered a new thing (:

[WayBack] View multiple panes, sheets, or workbooks – Excel for Mac:

In Excel for Mac, you can split a sheet in to panes, view multiple sheets in one workbook, or view multiple workbooks at a time.

View multiple sheets in one workbook

  1. Open the workbook that you want to view.
  2. On the Window menu, click New Window.
  3. Switch to the new window, and then click the tab for the sheet that you want to view.Repeat steps 2 and 3 for each sheet that you want to view.
  4. On the Window menu, click Arrange.
  5. Do one of the following:
    To arrange windows So that they appear like this Click
    As equally sized, tiled squares Tiled windows Tiled
    Horizontally from top to bottom Horizontal windows Horizontal
    Vertically from right to left Vertical windows Vertical
    In an overlapping cascade from top to bottom Cascading windows Cascade
  6. Select the Windows of active workbook check box.

View multiple workbooks

  1. Open all the workbooks that you want to view.
  2. On the Window menu, click Arrange.
  3. Do one of the following:
    To arrange windows So that they appear like this Click
    As equally sized, tiled squares Tiled windows Tiled
    Horizontally from top to bottom Horizontal windows Horizontal
    Vertically from right to left Vertical windows Vertical
    In an overlapping cascade from top to bottom Cascading windows Cascade

–jeroen

Posted in Excel, Office, Office 2011 for Mac, Power User | Leave a Comment »

Learned that figuring out Excel formula dependencies has been there since at least Excel 2000 (:

Posted by jpluimers on 2022/03/01

Sometimes, you figure out Excel functionality you have never needed before, but has been there for decades.

A while ago, I had a very complex with formulas referencing full columns back and forth when suddenly I got into something strange: when reloading the spreadsheet, values would not appear because of recursion errors. Before saving this was fine, so it was hard to track back where I want wrong.

So I was happy to find out that Excel has two cool features for this:

  • Trace Precedents
  • Trace Dependents

Heck, looking at the icons I had a feel these features had been there for a long time. Boy, was I surprised to find them in [Wayback] Excel 2000 – Student Edition – Complete (a great book by the way), as you can see in this picture:

Excel 2000 - Student Edition - Complete - Trace precedents, dependents, error

Excel 2000 – Student Edition – Complete – Trace precedents, dependents, error

As others can explain this feature so much better than I can, here are some links:

–jeroen

 

Posted in Excel, Office, Office 2000, Office 2003, Office 2007, Office 2010, Office 2011 for Mac, Office 2013, Office 2016, Power User | Leave a Comment »

Some links on Excel format strings

Posted by jpluimers on 2022/01/25

In Get Formatted Value of Cell in Excel – Stack Overflow, I focused on the =TEXT function, then indicated I would look into Excel format strings later.

Below are just a few links and a very short description as hopefully later I will have more time to dig into this.

The basic format is this (where all bits other than Format1 are optional):

[Locale]Format1;Format2;Format3;Format4

For now this is for my link archive:

  • [Wayback] Excel number format strings (e.g. “@”, “$-409]d-mmm-yy;@”) – Complete reference availability? – Stack Overflow has two answers of which the second one is deleted, but very useful:
    1. Here’s a list of the Number Format Codes for Excel.
      • Second option for link: Ecma-376 4th Edition Part 1, Section 18.8.31
    2. If you are looking for the international number codes try at http://office.microsoft.com/en-gb/excel-help/creating-international-number-formats-HA001034635.aspx
  • The HA001034635 link has disappeared, which is a pity as it explains the localisation; luckily two forms of the URL have been saved where [Locale] is constructed like this example (all Locale digits are hexadecimal):

    [$-24050412]m/d/yy

    In the preceding example:

    24  is the numeral shape component (Korean 1).
    05  is the calendar type component (Korean (Tangun era)).
    0412  is the locale and language designation component (Korean).

    1. [Wayback] Archive.is: Creating international number formats – Excel … HA001034635.aspx
    2. [Wayback] Archive.is: Creating international number formats – Excel – Office.com … HA001034635.aspx?redir=0
  • More [Locale] information is explained in [Wayback] What does the 130000 in Excel locale code [$-130000] mean? – Stack Overflow by [Wayback] User IrwinAllen13 – Stack Overflow and has more calendar formats than the above Microsoft links.
  • [Wayback] Number format codes – Excel for Mac has the base and sort of explains what the @ is for: the content of the cell.

    First the base:

    When you create custom number formats, you can specify up to four sections of format code. These sections of code define the formats for

    1. positive numbers,
    2. negative numbers,
    3. zero values, and
    4. text,

    in that order. The sections of code must be separated by semicolons (;).

    The following example shows the four types of format code sections.

    Four types of format code sections

    Callout 1 Format for positive numbers

    Callout 2 Format for negative numbers

    Callout 3  Format for zeros

    Callout 4  Format for text

    Then on on specifying less than 4 sections:

    • If you specify only one section of format code, the code in that section is used for all numbers.
    • If you specify two sections of format code, the first section of code is used for positive numbers and zeros, and the second section of code is used for negative numbers.
    • When you skip code sections in your number format, you must include a semicolon for each of the missing sections of code.
    • You can use the ampersand (&) text operator to join, or concatenate, two values.

    Then on the @ sign (which is under “Text and spacing”):

    To create a number format that includes text that is typed in a cell, insert an “at” sign (@) in the text section of the number format code section at the point where you want the typed text to be displayed in the cell.

    For example, to include text before the text that’s typed in the cell, enter “gross receipts for “@ in the text section of the number format code.

    Finally it explains how to colorise the formatting or hide particular values under “Decimal places, spaces, colors, and conditions”:

    The color code must be the first item in the code section.

    [Black] [Blue] [Cyan] [Green] [Magenta] [Red] [White] [Yellow]

    Hiding various values:

    To hide Use this code
    Zero values 0;–0;;@
    All values ;;; (three semicolons)
  • [Wayback] ECMA-376 – Ecma International where Ecma-376 4th Edition Part 1, Section 18.8.31 is supposed to have format strings (will dig into this later)

    Office Open XML file formats – This Standard defines Office Open XML’s vocabularies and document representation and packaging

    1. [Wayback] ECMA-376, Part 1
    2. Not sure where Part 2 is
    3. [Wayback] ECMA-376, Part 3
    4. [Wayback] ECMA-376, Part 4
    5. Not sure where Part 5 is

Below a few screenshots while experimenting.

The first one shows the formulas, the second one the content. The Date value cells shows the values when entered as shown; the Date formatted cells are all formatted with yyyy-mm-dd;@ formatting.

I still need to figure out why using a =TEXT function shows #VALUE! whereas using cell formatting just a bunch of ############### (15 times a #, not sure if that is always the same number).

–jeroen

Posted in Development, Excel, Office, Office Development, Power User, Software Development | Leave a Comment »

 
%d bloggers like this: