Author Archives: David Hager

About David Hager

Retired. Now very active in Excel community. Contact me with job opportunities.

#Excel Super Links #15 – shared by David Hager

Issue #15 is here!

Which numbers add up to total? Using Only Excel Formulas

Modifying Your List of Recently Viewed Excel Files

Daylight Saving Time And Time Zones In M (Power Query)

Use DAX and Slicers to Define Thresholds for Sentiment Analysis

Creating a Unique Delimited String from an Excel Filtered List by Using the TEXTJOIN Function


#Excel: Using Conditional Formatting to Highlight 3D Formulas with Defined Names by David Hager

There was a comment on LinkedIn about my post about using CF to highlight 3D formulas

“Since I never use a direct reference (or, come to that, enter a formula without naming the range to which it applies) any 3D reference I might use would pass under the radar. Unless, of course, you have an array UDF which will parse the formula to yield a set of references; in which case can I put in an order?”

Initially, I replied that it was not possible. But, the challenge was irresistable. I started working on the problem and, after a number of dead-ends, I was able to come up with a solution. It required a VBA function to return an array of defined names.

Function DefinedNameArray() As Variant


Dim Arr As Variant

nCount = ActiveWorkbook.Names.Count

ReDim Arr(1 To nCount)

For N = 1 To nCount

cPos = InStr(1, ActiveWorkbook.Names(N).RefersTo, “:”)

ePos = InStr(1, ActiveWorkbook.Names(N).RefersTo, “!”)

If cPos < ePos Then

Arr(N) = ActiveWorkbook.Names(N).Name


Arr(N) = “”

End If



DefinedNameArray = Arr

End Function

What the VBA function does is return an array of defined names, but only places the items meeting the correct criteria for a 3D formula in the final array (which is the same concept using in the initial article).

In this case, the InStr function was used to locate the positions of the first colon and exclamation point in the RefersTo string and the values are compared. If cPos<ePos, then the name is added to the array and a null string added otherwise. This array is used in the following formula to find if a 3D defined name is part of the string returned by the FORMULATEXT function. It was defined for use as a CF formatting formula, as shown below (F5 was the active cell when defined).



Both F5 and F7 contain formulas using 3D defined ranges.

Peter, thanks for the challenge!

You can download the example file here.


Excel Short & Sweet Tip #6 (Shuffling a String) by David Hager

The ability to randomly scramble a string using Excel formulas does not appear to be possible without helper cells. So, a VBA procedure is needed to accomplish this.

Originally posted at:

this VBA function procedure uses a string as the argument and shuffles that string. Copy/paste this procedure into a module in the VBE.

Function ShuffleString(s As Variant)

On Error Resume Next

Dim CL As New Collection


ShuffleString = “”

Do Until CL.Count = Len(s)

R = Int(1 + Rnd * Len(s))

CL.Add R, CStr(R)


For i = 1 To CL.Count

ShuffleString = ShuffleString & Mid(s, CL(i), 1)


End Function

So, the string in A1 is rearranged with =ShuffleString(A1) entered on the worksheet. For example, the string “evert” is shuffled to “rteve”.

#Excel Super Links #14 – shared by David Hager

I will likely end this daily series of Super Links at issue #20, but will continue to add issues as available.

Calculating Pearson Correlation Coefficient using DAX

Compare equivalent periods in DAX

Excel udf: Fuzzy lookups

Extract Data from a Mixed Column with Power Query

Scaling in-cell charts with an Excel formula


#Excel: Using Conditional Formatting to Highlight Cells Containing Native 3D Formulas by David Hager

Conditional formatting (CF) in Excel can be used to hightlight cells that meet certain criteria. In this case, I wanted to create a CF that would highlight cells containing formulas that use Excel’s native 3D references. So, this would be like the following example.


So, I tried to determine what was unique this type of formula string compared to others. What I noticed was that the first colon in this formula always comes before the exclamation point. Thus, I started working on a solution on that basis.

Note, though, that there are ways to write a formula containing a 3D reference that will not meet this criteria, such as:


So, don’t use those kinds of formulas. 😊

To lookup the position of the colon in the formula string, the following formula is needed.


where F6 contains the formula.

The corresponding formula for looking up the position of the exclamation point is:


By comparing the two formulas, the following Boolean expression wrapped in an IFERROR function is defined as Is3D:


Applying this formula as a CF on cell F6, you can see that F6 is highlighted as expected.


You can download the example file here.


#Excel Super Links #13 – shared by David Hager

Thanks for visiting my site to see the latest super links.

Adding a Description and Category to your User Defined Functions in Excel

Deep Dive into Power Query Formula Language

Tom’s Tutorials For Excel: Conditionally Formatting Locked and Unlocked Cells

Excel’s CUBE functions Explained

Using the Excel TEXTJOIN Function To Return Unique Items In A One-Cell Delimited String From A 2D and 3D Range


Excel Short & Sweet Tip #5 (Hiding Error Triangles) by David Hager

Would you like a way to remove those green error checking triangles from worksheet cells, yet retain error checking? Go to File, Options, Formulas, Error Checking. Leave the “Enable background error checking” box checked, and change the Indicate errors using the color (default is green) to white. Of course, this only works if the cells are white. To turn off the error checking and the green triangles, change the “Enable background error checking” box to unchecked.