Showing posts with label microsoft. Show all posts
Showing posts with label microsoft. Show all posts

Wednesday, October 15, 2008

Microsoft Excel Add-in

I was recently thinking a lot about tiered pricing of items. I spend a lot of time in the Excel help files and googling about my issue.

My specific problem: I wanted to evaluate many different pricing schedules. I had a lot of clients and I wanted to evaluate the impact of each pricing schedule on each client.

I could have done it with a lot of if statements in a lot of columns. The problem is that is not dynamic enough. I didn't know how many tiers I would need. Plus, it isn't just finding the right tier and applying that price. I also needed to price incremental units on the next tiers. For example, you buy 1000 units. The first 100 cost $2, the next $100 cost $1 and anything about cost $0.50. So, each additional unit lowers your average unit cost.

Anyways, I did it by writing a function in excel and have created an add-in that you can use. Download it here. Code follows:


Function TieredPrice(volume As Double, tiers As Variant, prices As Variant) As Double
    TieredPrice = 0
    If IsObject(prices) = True Then
    If TypeOf prices Is Excel.Range Then
       If prices.Rows.Count > 1 And prices.Columns.Count > 1 Then
            TieredPrice = CVErr(xlErrRef)
            Exit Function
        End If
        If prices.Rows.Count > 1 Then
            NumCells = prices.Rows.Count
        Else
            NumCells = prices.Columns.Count
        End If
        pricesUB = NumCells
    Else
        TieredPrice = CVErr(xlErrRef)
        Exit Function
    End If
    End If
   
    If IsObject(tiers) = True Then
    If TypeOf tiers Is Excel.Range Then
       If tiers.Rows.Count > 1 And tiers.Columns.Count > 1 Then
            TieredPrice = CVErr(xlErrRef)
            Exit Function
        End If
        If tiers.Rows.Count > 1 Then
            NumCells = tiers.Rows.Count
        Else
            NumCells = tiers.Columns.Count
        End If
        tiersUB = NumCells
    Else
        TieredPrice = CVErr(xlErrRef)
        Exit Function
    End If
    End If
  
    If tiersUB = pricesUB Then
        If volume < tiers(1) Then
            fee = volume * prices(1)
        Else
            fee = tiers(1) * prices(1)
        End If
   
        For i = 2 To pricesUB
            If (volume - tiers(i - 1) < tiers(i) - tiers(i - 1)) Then
                If (volume - tiers(i - 1)) < 0 Then
                    fee = fee
                Else
                    fee = fee + (volume - tiers(i - 1)) * prices(i)
                End If
            Else
                If (tiers(i) - tiers(i - 1)) < 0 Then
                    fee = fee
                Else
                    fee = fee + (tiers(i) - tiers(i - 1)) * prices(i)
                End If
            End If
        Next i
   
        TieredPrice = fee / volume
      
    Else
        TieredPrice = CVErr(xlErrRef)
        Exit Function
    End If
   
End Function

Reblog this post [with Zemanta]

Saturday, August 23, 2008

Keyboard to a Man's Heart Part 3

Tab key on a standard Windows keyboardImage via Wikipedia You should know by now how much I love the keyboard. I try very hard to convince people to shun the mouse (and especially their laptop touchpad) and start using the keyboard.

I constantly rack my brain trying to understand what are the sticking points preventing keyboard adoption and how I can overcome them. Productivity gains are not enough for most people (for some crazy reason). Despite the fact that you obviously don't care, I will continue to plead my case.

I think there are a few factors at work here. People are generally frightened of computers. They don't understand the design of the technology. They are scared to look through the advanced features and make changes. (I worked in technical support, so I have seen just how ignorant people can be when it comes to computers. Even remembering two different passwords can be a herculean feat.) On top of that, it takes some effort to learn a new trick. I've heard this a few times, 'For me, the mouse will always be faster'. No way. Not possible. Especially not if you're starting with your hands on the keyboard. Sure, it might take a minute to learn the shortcuts, but trust me they make your life a whole lot easier.

In order to simplify the world of keyboard shortcuts here are some ways to think about navigating Microsoft programs from the keyboard (some apply to Apple, generally by switching ALT for the Apple key)

  • ALT + TAB - cycles through open programs
  • SHIFT + ALT + TAB - cycles backwards through open programs
  • CTRL + TAB - cycles through open windows within a program (this works in most programs, but not all, and is especially great when using tabbed internet browsing)
  • SHIFT + CTRL + TAB - cycles backwards through open windows within a program
  • ALT + F4 - closes a program
  • CTRL + F4 - closes a window within a program
You may have noticed a pattern. ALT works at the global level and CTRL works within the programs. SHIFT will shift the direction of your actions for some commands.

Another key tip to keep in mind is that windows keyboards have the menu key. I call this the right-click key because it brings up the right-click menu that you would get from the mouse. Sometimes faster than knowing the actual keyboard shortcut to perform a specific action.

The other windows specific key that you should know about the Windows Key. There are a few keyboard shortcuts associated with this, but for me, the best one is just that it brings up the start menu and with that, access to all your programs with just a few keystrokes. For example, you hit Windows Key + P to open the programs list and then pressing the first letter of your program name will take you there. In Windows Vista, the start menu has been improved by providing you a search bar that you can just type in what you're looking to open and it brings it right up.

Lastly, you should definitely be aware of the generic ARROW KEYS and PAGE UP/PAGE DOWN keys. These bad boys will let you easily scroll down a webpage or document you are using and are a million times faster than going to that stupid scroll bar at the right side of the screen.

So, those are all good tips. I use them constantly. Frankly, if this is the first you've heard about ALT+TAB, welcome to the first day of the rest of your life.

I'll leave you with this bit of wisdom to help you implement this in your daily life: (it's not even just for the keyboard)
If you use Microsoft Powerpoint, I have a couple of really good tips. First, always use snap to grid and snap to shape. Then, you can select items (using TAB to cycle through the objects on the slide rather than the mouse). Move those objects into place using the ARROW KEYS. By keeping snap to grid on and using the arrow keys, you can be sure that your objects are nicely aligned. If for some reason, you need more granular control, you can use CTRL+ARROW KEYS to move as though snap to grid was off (though I'm not sure why you would want to do that). You could also use ALT+the mouse to do the same thing (occasionally useful for resizing objects). This tip is especially useful for consultants working on laptops while on the road (with that awful touchpad).

I'll be back with more tips on making the keyboard the focus of your computer input devices. If you'd like special one-on-one sessions, I am available for private tutoring. I already have one McKinsey consultant 'raving about the keyboard shortcuts' I introduced into his life.

Now, get out there and try using those shortcuts!

Reblog this post [with Zemanta]