<![CDATA[leverageexcel.com - Blog]]>Wed, 15 Apr 2020 03:21:57 -0700Weebly<![CDATA[Unhide All Tabs]]>Sun, 22 Mar 2020 17:34:24 GMThttp://leverageexcel.com/blog/unhide-all-tabsOften when I'm working with a workbook, we have multiple (sometimes dozens) of different sheets in a file.  It can be frustrating to unhide all those tabs manually to see the data.  Below is a simple snippet that will quickly unhide all tabs in the workbook. 

Sub DisplayAllTabs()
    'Run this code to unhide all tabs in workbook
    On Error Resume Next
    t = ActiveWorkbook.Sheets.Count
    For i = 1 To t
        ActiveWorkbook.Sheets(i).Visible = True
    Next i
End Sub

It's worth mentioning the three types of Visible statuses available to us:
  • True = The sheet is visible
  • False = The sheet is not visible (and can be made visible by right-clicking a visible tab name and selecting 'unhide')
  • xlVeryHidden = The sheet is not visible (and can only be made visible from the VBA project properties for that sheet - it's not even listed when attempting to unhide tab via right-clicking)
It's also worth noting that the On Error Resume Next is only applicable if you tweak the code to hide cells (the last visible sheet cannot be hidden and will give an error).

Hopefully this saves you some time - I know it will for my projects.
<![CDATA[Customizable Activity / Rest Timer]]>Thu, 05 Sep 2019 12:47:02 GMThttp://leverageexcel.com/blog/customizable-activity-rest-timerOkay, this one isn't actually an Excel tool, and from what I've read I picked a pretty out-dated programming language to write this in.  I originally wrote this in Python, but didn't share it because I knew not everyone had Python on their machines.  Not being familiar with a lot of my other options, the project was shelved for nearly a year until an unrelated article lead me to Visual Basic - which works fine for my purposes.

Anyway, back to the file...  It was inspired after my former boss told us about the Pomodoro technique for cycling between times of work and taking breaks.  I wanted something more customizable, so I built this.  When you first open the file, there are 3 prompts.
  • How many minutes of activity?
  • How many minutes of rest?
  • How many cycles of activity?
The file cycles through activity / working sessions - then prompts you when it's time for a break.  It then cycles through your rest time - prompting you when its time to begin the next activity.  The cycle continues for the set number of times.

There isn't an OFF switch, so if you decide to kill it, you'll need to do so from the Task Manager.

File Size: 1 kb
File Type: vbs
Download File

<![CDATA[Generate Reporting Hierarchy]]>Wed, 04 Sep 2019 00:02:08 GMThttp://leverageexcel.com/blog/generate-reporting-hierarchyI'll need to post a video for how to use this file, but for now I can still share it and talk through how it works.

Start by pasting your data into A:E; Employee ID, Employee Name, a Group label for your data, then Manager ID, and lastly Manager Name.  Then you'll enter your most senior leader into G1.  This is the employee who all other employees should roll through.

After you click "Generate Hierarchy" the file will prompt you to select which group you're generating a hierarchy for.  Typing 1 will generate the hierarchy for the entire population, but the option is there to only generate the hierarchy for employees within a specific group.  The group option is faster - especially when we're talking about organizations with tens of thousands of employees.  99% of the time I use option 1 here.

When the file finishes, you'll have 2 new tabs; PIVOT and Hierarchy.  The hierarchy tab is where we've looped through 20 levels of supervisor reporting relationships showing who reports to who up through your organization. Column AT is the "Status" which identifies "Infinite Loops"  (employees reporting to themselves or lower level direct reports - causing these loops) and "Dead Ends" which is an manager who isn't on your list - often a terminated employee.  Either of these reasons will cause the hierarchy to not reach the top person you identified.  Anyone else is labeled as "Okay".

The remaining columns build the hierarchy structure to make it work nicely with the pivot table.  M0 is the leader you identified.  M1 is their direct employees. M2 is 2-levels down...

The PIVOT tab is where we roll up the hierarchy.  If you add a COUNT of Employee Name, you can easily see how many people report to who at each level of your organization, or perhaps you add salary data and create SUM of Salary to show the total salary base rolling up to each leader through the organization.

Play with the data to determine what's meaningful for you and your organization, but this file should save you loads of time having to manually build all of these formulas.

In custom files, we can generate the hierarchy as a part of a larger process and identify which employees roll up through which leaders, or we can breakout data so that managers at a certain level are able to view all direct and indirect reports.  The possibilities are limitless, and it's always fun to find creative solutions to help achieve whatever the end goal is.

File Size: 54 kb
File Type: xlsb
Download File

<![CDATA[Training Consolidation & Distribution]]>Mon, 02 Sep 2019 13:38:11 GMThttp://leverageexcel.com/blog/completed-project-training-consolidation-distributionI'm happy to report this one went off without any major hitches on my end.  The client ran into some data-related issues at multiple points in this project, which highlights the importance of having good data and maintaining consistency.

• Training Program Consolidation - Training and certifications are housed in half a dozen different source systems. Export those reports and save them all into a folder. From there we designed a master template and built code to cycle through all of those files, opening each, clean the data, and pull completion dates and statuses into our master - taking what was a multi-day task and automating it down to click a button, get your coffee, and when it'll be done by the time you return.
• Once our master list was built, we designed code to generate separate files by manager. We end up generating about 3,000 Excel files for managers which include their direct + indirect reports; "John Doe - EE ID.xlsx". We then send these managers an email and attach their file. If we need to password protect the files we could have, but not having any PII we opted to skip this step.
• Data Consolidation - Continuing with the above example, if the managers had to make changes or give feedback and then return all of these files to us. We can drag these files into a single folder, and cycle through that folder to copy / paste their data back into an updated master. Part of this process, we read the headers to ensure they align with our master, and we can flag any files where the headers appear wrong and we don't copy that data. Again, automating this consolidation saves hours of copying and pasting.

Lessons Learned: The only part I would have probably changes was the data distribution.  Generating thousands of files took a couple of hours (granted you go to lunch and the computer keeps cranking) but then distributing thousands of files took even longer.  It was about 5 hours before the emails cleared the outbox.  In hindsight, I probably should have used our password-prompted encryption / decryption process.  This way we could have only sent the one file out to all of the managers.  Though we'd still have to communicate the passwords to the managers, these emails wouldn't have contained attachments and would have cleared the outbox much faster.
<![CDATA[When TRIM Won't Work]]>Fri, 09 Aug 2019 01:31:13 GMThttp://leverageexcel.com/blog/when-trim-wont-workYou've been there...  Trying to do a VLOOKUP and it just doesn't want to work.  I've been in the habbit of using =TEXT(TRIM(A1),0) whenever I do a VLOOKUP using employee numbers, because in so many of our reports, sometimes these IDs are numbers, sometimes they're text, and sometimes their both.  Just making the TEXT and TRIM functions a habit has saved me some headache. 

Today, I ran into the situation where this still didn't resolve the issue.  For whatever reason, this new system we have has been designed to add trailing characters to IDs.  They looks like spaces, but they aren't, and TRIM doesn't clean them up.  They're actually the CHAR(160) symbol. 


Anyway, this formula is likely overkill, but sometimes overkill is just enough.  This formula combines several different text cleanup functions:
  • TRIM - removes extra spaces, including the dreaded leading or trailing spaces
  • CLEAN - removes line breaks and certain other characters
  • SUBSTITUTE - substitutes one character for another - in this case we're substituting the CHAR(160) character with empty quotes which results in it being removed

<![CDATA[Return a Person's First Name]]>Mon, 05 Aug 2019 07:00:00 GMThttp://leverageexcel.com/blog/return-a-persons-first-nameOften - normally when I'm doing something related to email or letter generation - I need an easy way to capture the person's first name to open my communication.  Normally I'd use Text-to-Columns, but if the data is poorly structured and there's a mix of FIRST LAST with LAST, FIRST that isn't always an option.  I put this formula together to recognize how the name is formatted, and grab the first name accordingly.  Hopefully it saves you some time. 

=PROPER(IFERROR(IFERROR(LEFT(RIGHT(A1,LEN(A1)-FIND(", ",A1)-1),FIND(" ",RIGHT(A1,LEN(A1)-FIND(", ",A1)-1))-1),RIGHT(A1,LEN(A1)-FIND(", ",A1)-1)),LEFT(A1,FIND(" ",A1&" ")-1)))
<![CDATA[Using Conditional Formatting to Highlight an Entire Row]]>Thu, 01 Aug 2019 07:00:00 GMThttp://leverageexcel.com/blog/using-conditional-formatting-to-highlight-an-entire-rowMany of us already understand the fundamentals of conditional formatting - highlighting cells that meet certain criteria, but what if you wanted to draw even more attention to the entire row of data.  Maybe you have a large spreadsheet and some alert field is at the far end of your data set, and you don't want to keep scrolling to see whether a condition is met.  Sometimes, it's helpful to highlight the entire row with conditional formatting. 

The trick here is to create your condition and set your anchor so it stays in the target column, but the 1 but without the anchor so the row can freely move; =$B1="Awesome", but then apply the condition to more than one column.

I occasionally run into the situation where after creating the condition, I have to go back into the Rule and reset the row to 1.  This target sometimes jumps to the bottom of the workbook when you first create the rule.

This is probably easier to follow in a video, so enjoy!
<![CDATA[Intro to Pivot Tables]]>Thu, 25 Jul 2019 07:00:00 GMThttp://leverageexcel.com/blog/intro-to-pivot-tablesI'm surprised how often I get asked for help with building or manipulating pivot tables.  Pivot tables are amazing tools to help summarize large amounts of information quickly and easily.  It's often useful to just start throwing different fields into your pivots to see what makes sense and get a general feel for your data.  Rather than going into a lengthy post, I figured a quick video overview would be a better choice.  Enjoy.
<![CDATA[Email Generation / Password Distribution]]>Tue, 09 Jul 2019 07:00:00 GMThttp://leverageexcel.com/blog/email-generationThis file goes hand-in-hand with some of the other functionality discussed.  If we're using our encryption / decryption logic, we need a simple way to distribute the unique PINs to the various users.  That's where this file comes it.  You only need to populate 2 columns, and the email generated is very generic - but it does the trick. 

What makes this file unable to work cohesively with the Breakout Data file is the fact that I do now know what naming convention you've chosen for your Breakout files.  We can update the code to auto-attach your file, but that require some additional work.  Rather than having your populate hundreds or thousands of columns manually in this file, it's far simpler to simply coordinate with us on the front-end.  We can capture the file names used in the Breakout Data file, and populate the specific attachment names in this file for a more seamless process.  It's also completely possible to customize the email and make it more specific to your individual process.

Please reach out for any additional functionality.  In the meanwhile, I hope you find this file serves its purpose and saves you some time.
File Size: 33 kb
File Type: xlsb
Download File

<![CDATA[Breakout Data]]>Tue, 02 Jul 2019 07:00:00 GMThttp://leverageexcel.com/blog/breakout-dataThe idea for this one came about after spending an afternoon breaking our master table down into dozens of smaller files for distribution, and then having to redo the whole project after being told to include additional columns. 

This tool is pretty straight forward.  To use it, simply paste your data into the Data tab and click a button.  The file will read your headers and you'll be prompted to select which header you wish to breakout the data using.  Enter the corresponding column and click OK.

Let's assume you're breaking out an employee population by manager, so you'd enter the column which contains the manager ID.  You then go grab some coffee.  The file will generate a file for each manager ID and save each file onto your Desktop - they may also be saved to your Documents folder or your most recent working folder - for whatever reason, it doesn't always put the files where it's told.

The only real headache with this tool is that you still have to distribute all of the files to the appropriate manager, and this file doesn't support a unique password for each file.  This can certainly be done.  Feel free to reach out if you need additional functionality to support your needs.
File Size: 34 kb
File Type: xlsb
Download File