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 1,861 other subscribers

Archive for the ‘Excel’ Category

How to Extract a Number or Text from Excel with this Function

Posted by jpluimers on 2019/11/11

Lots of fuzz, but the formula towards the end worked:

=SUMPRODUCT(MID(0&A1,LARGE(INDEX(ISNUMBER(--MID(A1,ROW($1:$25),1))*
ROW($1:$25),0),ROW($1:$25))+1,1)*10^ROW($1:$25)/10)

Source: [Archive.isHow to Extract a Number or Text from Excel with this Function

More of those at [WayBack] Extract Only Numbers From Text String

–jeroen

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

Excel on Mac OS X / macOS: character that sorts after Z

Posted by jpluimers on 2019/10/04

Sometimes in a table, you want to have a key column where one of the rows sorts after Z (for instance having a total value further on).

The A-Z sort order sorts all non-letter ASCII characters in front of A-Z and a-z because [WayBack] Excel sorting is not in ASCII order – Microsoft Community, see ASCII Sort.xlsm – Microsoft Excel Online.

Using =NA() (which displays as  #N/A  ) is too visually intrusive (but works, see: [WayBack] Forcing an item to sort last in Excel [Archive] – Actuarial Outpost)

Luckily, putting in an Arabic character like  works. You can even put it in front of normaal ASCII characters like in 'ٴ ----- which then displays it at the right (since Arabic is Right-to-Left) -----ٴ .

The character is high Hamza – Wikipedia; [WayBack] Unicode Character ‘ARABIC LETTER HIGH HAMZA’ (U+0674)

via:

–jeroen

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

Excel Pivot notes: Table, Pivot Formula, 2D, 3D charts and secondary axes.

Posted by jpluimers on 2019/10/04

Since I don’t do Excel visualisations often enough, I always forget the details on Pivot Charts, some links and tips below.

TL;DR

You can’t have enough axes

The tips below assume you can create a pivot table from an existing table (that already can contain formulas), then show you:

  • additional formulas in your original table can make life easier
  • formulas for pivot tables themselves (named “Calculated Fields”)

Problem at hand

Creating graphs out of up and down time durations over time, aggregated by day.

Ideas for correlations that might matter:

  1. linear over time during a few weeks
  2. by week and by day of week

Incoming data:

  • end-timestamp
  • state (down or up)
  • duration of that state

Calculations

First of all, I needed “day of month”, “day of week”, and “week number” so I could group by those. Based on Readable weekdays in Excel, you get formulas like these:

  • =DAY(B4)
  • =WEEKDAY(B4) and =TEXT(B4;"dddd")
  • =WEEKNUM(B4)

Then I needed to split the duration of the state in distinct up/down durations. So I made a few formulas:

  • =("Up", A4) to have a boolean for up/down
  • =("Up", A4) to have a boolean for up/down
  • =IF(D4;C4;0)to split the up duration from the state duration
  • =IF(NOT(D4);C4;0)to split the down duration from the state duration

A pivot table could aggregate total up and down durations, but I wanted a measure of up ratio, so I needed a formula inside the pivot table itself.

Following the steps at [WayBackCalculate values in a PivotTable Use different ways to calculate values in calculated fields in a PivotTable report in Excel 2010, I got to this one:

This aggregates nicely: drag it to the aggregates column, then change the aggregation to “Average”:

Putting it in a 3D Pivot Chart

Read the rest of this entry »

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

Readable weekdays in Excel

Posted by jpluimers on 2019/09/30

Since I always forget this: [WayBackExceljet: Get day name from date

If you need to get the day name (i.e. Monday, Tuesday, etc.) from a date, there are several options depending on your needs.

Basically there are four ways go get the day of the week; the first three are readable, but when ordered, they are ordered alphabetically. The last one is numeric.

Combining the numeric with the text is easier in for instance Pivot Legend Fields (Series).

So here they go (based on the above link), assuming that B4 contains a timestamp:

  1. =WEEKDAY(B4) gives you the numeric weekday (starting with Sunday=1 to Saturday=7) which allows sorting in a meaningful order
  2. =TEXT(B4,"dddd") gives you the full day name of B4 in your locale
  3. =TEXT(B4,"ddd") gives you the shortened day name of B4 in your locale
  4. =CHOOSE(WEEKDAY(B4),"Sun","Mon","Tue","Wed","Thu","Fri","Sat") gives you a name of your liking from a series of 7 texts

Note that depending on your locale, these formulas might actually need a semicolon:

  1. =WEEKDAY(B4)
  2. =TEXT(B4;"dddd")
  3. =TEXT(B4;"ddd")
  4. =CHOOSE(WEEKDAY(B4);"Sun";"Mon";"Tue";"Wed";"Thu";"Fri";"Sat")

–jeroen

Read the rest of this entry »

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

Excel on Mac OS X: Insert, move, or delete page breaks in a sheet

Posted by jpluimers on 2019/08/16

Since I always get confused by the differences in Excel versions (not just between Mac OS X  and Windows):

In Excel for Mac, you can adjust where automatic page breaks occur, add your own page breaks manually, and remove manual page breaks.

Source: [WayBackInsert, move, or delete page breaks in a sheet.

–jeroen

Read the rest of this entry »

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

Excel: printing top row on every page, and including grid

Posted by jpluimers on 2019/06/28

I hardly print with Excel, so I always forget these two:

–jeroen

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

ms office – Keyboard shortcut to select all text in a cell in Excel – Ask Different

Posted by jpluimers on 2019/06/10

Via [WayBack] ms office – Keyboard shortcut to select all text in a cell in Excel – Ask Different a few keyboard tips.

Lets start with the shortest one:

  1. Put the focus on the cell (click, use arrow keys, etc)
  2. Press space
  3. Press CommandZ or ControlZ to undo the change

This probably is unintended, but works great: all text is now selected, so you can copy/cut with Command-C/CommandX.

Now the “official” way:

  1. Put the focus on the cell (click, use arrow keys, etc)
  2. Press ControlU or F2 to edit the cell (the cursor is now at the end)
  3. Press ShiftAltHome or ShiftControlHome (to select all text)
    note: Home can also be FnLeft.

Other selections you can make while the cell is in edit mode:

  • Press ShiftAltEnd or ShiftControlEnd (to select to the end of the cell)
    note: End can also be FnRight.
  • Press ShiftAltRight or ShiftControlRight (to select one word to the right)
  • Press ShiftAltLeft or ShiftControlLeft (to select one word to the left)
  • Press ShiftAltDown or ShiftControlDown (to select to the same position on the line below)
  • Press ShiftAltUp or ShiftControlUp (to select to the same position on the line up)

Keyboard symbols (more at [WayBackCommand, Option, & Shift Symbols in Unicode):

  • Shift
  • ^Control
  •  – Alt which is the same as Option
  •  – Command
  • Fn – Function

–jeroen

Posted in Apple, Excel, Mac, Mac OS X / OS X / MacOS, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, macOS 10.12 Sierra, Office, Office 2011 for Mac, Power User | Leave a Comment »

keyboard – How to add a line break in a cell in Excel for Mac – Ask Different

Posted by jpluimers on 2019/06/03

What key combination do I have to press to create a line break in a cell in Excel for Mac 2011? The Windows combination of Alt+Enter does not work on the Mac.

Source: [WayBackkeyboard – How to add a line break in a cell in Excel for Mac – Ask Different

The answer depends on the Excel for Mac OS X version you are using.

Excel 2015 is simple (thanks esham): use Option+Enter.

In older Excel <= 2011 (thanks nwinkler), use Command+Option+Enter or Control+Option+Enter.

Some users report the also need the Fn key in addition to the above modifiers.

–jeroen

PS: Later I found out that [WayBack] Beckism.com: Use a linebreak in Excel on Mac also shows the Excel <= 2011 solution Control+Option+Return (note that Return is the same key as Enter).

Posted in Apple, Excel, Mac, Mac OS X / OS X / MacOS, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, macOS 10.12 Sierra, Office, Office 2011 for Mac, Power User | Leave a Comment »

VLOOKUP Example Spreadsheet & Tutorial | Productivity Portfolio

Posted by jpluimers on 2018/08/10

Because I tend to forget how to use this:

Excel VLOOKUP tutorial with an example spreadsheet & video. The article shows how to lookup the values from one column to use in another worksheet column.

Source: [Archive.isVLOOKUP Example Spreadsheet & Tutorial | Productivity Portfolio

–jeroen

Read the rest of this entry »

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

Convert a text value into a date in Excel. Learn Microsoft Excel | Five Minute Lessons

Posted by jpluimers on 2017/01/09

To match dd/mm/yyyy and mm/dd/yyyy column values in columns C (Date1) and N (Date2), I used these formulas in row 2:

Meaning: Column: Formula: Explanation:
Date1Text I =TEXT(C2,”dd/mm/yyyy”) Interpret date text of the original text no matter the Excel settings
Date1Value J =DATE(RIGHT(I2,4),MID(I2,4,2),LEFT(I2,2)) Encode the date text to an actual date: dd#mm#yyyy format where # is any separator
DatesEqual K =J2=L2 Are the encoded dates equal?
Date2Value L =DATE(RIGHT(M2,4),LEFT(M2,2),MID(M2,4,2)) Encode the date text to an actual date: mm#dd#yyyy format where # is any separator
Date2Text M =TEXT(N2,”mm/dd/yyyy”) Interpret date text of the original text no matter the Excel settings

 

Learn how to convert text values into dates in Excel. This lesson covers a range of different scenarios to help you. The comments have even more examples.

Source: Convert a text value into a date in Excel. Learn Microsoft Excel | Five Minute Lessons

Posted in Excel, Office, Office 2007, Office 2010, Office 2013, Power User | 1 Comment »