Excel Insights
eBook - ePub

Excel Insights

A Microsoft MVP guide to the best parts of Excel

  1. 224 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Excel Insights

A Microsoft MVP guide to the best parts of Excel

About this book

 
Learn favorite techniques from this group of twenty-two Excel MVPs. The Excel MVPs are friends and competitors who each pulled out their favorite tricks to impress you and their fellow MVPs.

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn more here.
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access Excel Insights by 24 Excel MVPs in PDF and/or ePUB format, as well as other popular books in Computer Science & Desktop Applications. We have over one million books available in our catalogue for you to explore.

Information

Make Your Own VBA Worksheet Functions
When none of Excel’s native Functions do what you want, you can write your own Worksheet Functions (User Defined Function or UDF for short) using VBA. This chapter shows you simple step-by-step techniques that you may use to write efficient UDFs like a professional.
A Simple Averaging Function
Suppose you want to write a function that calculates the average of the absolute values from a range of cells while excluding from the average anything that is not a number or is less than a certain number, tolerance. Let’s call the function AverageTol. To do this,
  • Start Excel.
  • Alt + F11 gets you to the Visual Basic Editor (VBE).
  • Insert –> Module.
    Note: VBA Worksheet Functions MUST be in a standard module, not in a worksheet or other class module.
Then, enter the following VBA Code:
Function AverageTol(theRange, dTol)
For Each Thing In theRange
If IsNumeric(Thing) Then
If Abs(Thing) > dTol Then
AverageTol = AverageTol + Abs(Thing)
lCount = lCount + 1
End If
End If
Next Thing
AverageTol = AverageTol / lCount
End Function
The function loops through every cell in the range and, if the absolute value of the cell is a number greater than the tolerance, adds it to the total and increments a count. Finally, it divides the total by the count and returns the result.
Now, go back to the Excel worksheet, enter some data in cells A1:A10 and in B1 enter
=AverageTol(A1:A10,5)
That was pretty easy and works well for 10 cells. However, if you have a lot of data, say 32,000 cells, then 15 formulas using this UDF takes 2.3 seconds to calculate on my laptop.
One major reason this is so slow is that I used all the defaults: I was lazy and did not declare any of the variables, so they all defaulted to Variants. That’s SLOW … but I can easily improve it: here is version A of AverageTol:
Function AverageTolA(theRange As Range, dTol As Double)
Dim oCell As Range
Dim lCount As Long
For Each oCell In theRange
If IsNumeric(oCell) Then
If Abs(oCell) > dTol Then
AverageTolA = AverageTolA + Abs(oCell)
lCount = lCount + 1
End If
End If
Next oCell
AverageTolA = AverageTolA / lCount
End Function
This is the same function but with each variable declare...

Table of contents

  1. Smart Uses of Custom Number Formatting
  2. Ctrl + Enter
  3. Auto-Magically Master INDEX MATCH (and Other Formulas)
  4. Relative Named Ranges – When Named Ranges Go Walkabout
  5. An Introduction to Excel’s New Data Types
  6. A Look to the Future – Dynamic Arrays
  7. XLOOKUP Debuts in Excel
  8. Why the Love / Hate for Pie Charts?
  9. Intermediate Charting in Excel
  10. Creating Charts for Presentations
  11. Advanced Filter
  12. Power Query: Manipulate Your Data Like a Pro
  13. Combine All Files in a Folder
  14. Power Query M Code Approximate Match Lookup Formula
  15. The Power Behind the Boringest Sentence in Excel
  16. Understanding Context in Power Pivot
  17. Thinking Through the Modelling of a Seating Chart
  18. Financial Modelling
  19. Creative Excel Model Development
  20. An Introduction to Simulation in Excel
  21. Staying out of Trouble
  22. Make Your Own VBA Worksheet Functions
  23. An Overview of Modern VBA Best Practices
  24. About the MVPs
  25. Index