Number to Text in Excel

I was asked today by one of my classmates about converting numeric values to literal values in excel. I thought there was a function for this but I found none. Well I was curious so I looked it up on the web. I've done a little modification here to make it more or less generic (specially when writing in checks). Here's how it's done:
  1. Click Tools->Macro->Visual Basic Editor
  2. Insert a module
  3. Paste the following code:
Option Explicit
'****************
' Main Function *
'****************

Function SpellNumber(ByVal MyNumber)
Dim Temp, WholeNumberText, DecimalText
Dim DecimalPlace, Count

ReDim Place(9) As String
Place(2) = " Thousand "
Place(3) = " Million "
Place(4) = " Billion "
Place(5) = " Trillion "

' String representation of amount.
MyNumber = Trim(Str(MyNumber))

' Position of decimal place 0 if none.
DecimalPlace = InStr(MyNumber, ".")
' Convert cents and set MyNumber to dollar amount.
If DecimalPlace > 0 Then
DecimalText = Left(Mid(MyNumber, DecimalPlace + 1) & "00", 2)
MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
End If

Count = 1
Do While MyNumber <> ""
Temp = GetHundreds(Right(MyNumber, 3))
If Temp <> "" Then
WholeNumberText = Temp & Place(Count) & WholeNumberText
End If
If Len(MyNumber) > 3 Then
MyNumber = Left(MyNumber, Len(MyNumber) - 3)
Else
MyNumber = ""
End If
Count = Count + 1
Loop

Select Case DecimalText
Case ""
DecimalText = " and 0/100"
Case Else
DecimalText = " and " & DecimalText & "/100"

End Select
SpellNumber = WholeNumberText & DecimalText
End Function


'*******************************************
' Converts a number from 100-999 into text *
'*******************************************
Function GetHundreds(ByVal MyNumber)
Dim Result As String
If Val(MyNumber) = 0 Then Exit Function
MyNumber = Right("000" & MyNumber, 3)
' Convert the hundreds place.
If Mid(MyNumber, 1, 1) <> "0" Then
Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred "
End If
' Convert the tens and ones place.
If Mid(MyNumber, 2, 1) <> "0" Then
Result = Result & GetTens(Mid(MyNumber, 2))
Else
Result = Result & GetDigit(Mid(MyNumber, 3))
End If

GetHundreds = Result
End Function

'*********************************************
' Converts a number from 10 to 99 into text. *
'*********************************************

Function GetTens(TensText)
Dim Result As String

Result = "" ' Null out the temporary function value.
If Val(Left(TensText, 1)) = 1 Then ' If value between 10-19...
Select Case Val(TensText)
Case 10: Result = "Ten"
Case 11: Result = "Eleven"
Case 12: Result = "Twelve"
Case 13: Result = "Thirteen"
Case 14: Result = "Fourteen"
Case 15: Result = "Fifteen"
Case 16: Result = "Sixteen"
Case 17: Result = "Seventeen"
Case 18: Result = "Eighteen"
Case 19: Result = "Nineteen"
Case Else
End Select
Else ' If value between 20-99...
Select Case Val(Left(TensText, 1))
Case 2: Result = "Twenty "
Case 3: Result = "Thirty "
Case 4: Result = "Forty "
Case 5: Result = "Fifty "
Case 6: Result = "Sixty "
Case 7: Result = "Seventy "
Case 8: Result = "Eighty "
Case 9: Result = "Ninety "
Case Else
End Select
Result = Result & GetDigit(Right(TensText, 1)) ' Retrieve ones place.
End If
GetTens = Result
End Function


'*******************************************
' Converts a number from 1 to 9 into text. *
'*******************************************

Function GetDigit(Digit)
Select Case Val(Digit)
Case 1: GetDigit = "One"
Case 2: GetDigit = "Two"
Case 3: GetDigit = "Three"
Case 4: GetDigit = "Four"
Case 5: GetDigit = "Five"
Case 6: GetDigit = "Six"
Case 7: GetDigit = "Seven"
Case 8: GetDigit = "Eight"
Case 9: GetDigit = "Nine"
Case Else: GetDigit = ""
End Select
End Function



4. Close and return to excel
5. To use the macro, write the following on the cell to which you want to display the text version of your numeric value: =SpellNumber()
refers to the cell where your number value is written.




Trade Fairs

Trade fairs are events from which companies showcase their products and/or services. It is one way for companies to potentially grab a share of the market. In my previous post, a trade fair can be categorized under the third "P" which is "Promotion". Trade show displays, although they cost high, they aren't high enough compared to the benefit your business can get. Don't however, have just a plain display. First impression last. If your stand shows mediocrity, there is a big chance that you won't achieve your goal--introduce your product and/or service and get a market share from that area. Have at least an elegant truss, and not just any attractive looking truss but one that is related to your product and/or service. Banner stands definitely help in getting the customer's attention. They don't immediately see your display area you know. It's the same as a customer driving by the highway looking for a certain office. From his/her perspective, what can be seen are a couple of buildings from both sides of the road. However, when the office provides a banner or an add that is not displayed parallel to the office (displayed perpendicularly), the customer can immediately see this and eventually will find what he/she is looking for.

To know more about trade shows in your area, contact the appropriate government agency, or be a member of organizations related to your industry. Subscribe to newsletters so that you'll be updated on different schedules of exhibits. :D

Go and Multiply



I have been a member of Multiply.com since I really don't know when and I don't bother trying to find out. Yet, why am I posting this? It's because after visiting it back, I discovered that it already gained a page rank! Cool!!! I never thought it would reach that (Well I don't even have the perfect reason why I thought of it either :P). Well, one thing's for sure, I'm getting the hang of this blogging stuff. Thanks to my students! Being part of UIC sure is a good choice. (I crave for knowledge you know...) :D

Oh, by the way, visit my multiply site here.

Computer Stores

Davao City has many computer stores ready to supply our technological needs. Among my preferred stores are Computer World, Rasi, and Thinking Tools. I buy my personal computing needs at Thinking Tools. Although I don't really feel valued when buying something at their store, the price would make me stay and buy. Our computers in our company were bought at Computer World. Again, preference is given to them because of affordable price. All the rest that cannot be found in those two, we can acquire at Rasi. I wonder if I could save more if I buy online. My printer has high ink cost. I might be replacing it with a more affordable one. Lexmark printers perhaps or printers where I just have to buy a printer toner. Hmmm... it would be nice if it includes a scanner.
Well, it would be a lot better if it were a 3-in-1 (Printer, Photocopier, and Scanner) but without the high maintenance or usage cost. I haven't seen a 3-in-1 converted into a Continuous Ink Supply System (CISS). It would be a lot more convenient. Other things that I need to have their prices lowered down are networking peripherals. Routers, Switch, RJ45, CAT5 UTP Cable, etc. I might check out Superwarehouse computer store. One thing I noticed with this store though is that many products are old (e.g. laptop: most are IBM thinkpad. I'm using a lenovo now.). Well, I will still try to surf around their site. I might be able to find many things useful. I hope they have new networking gadgets. :D

A review on Searching Algorithms

Philnits sure is useful. The review reminded me of Searching 101 from which I only remember the Linear Search algorithm. Linear search is a method of searching in sequential order. Given the following values:

A = {4, 20, 31, 50, 23, 11, 30}
index 1 2 3 4 5 6 7

Searching is performed in sequential order which means if we are looking for the number 50, we start comparing it from values of index 1 until we reach the search item.

Another sorting algorithm is the Binary Search which is very useful when the elements are already sorted. Given the following values:

A = {1, 12, 30, 34 ,50 ,56, 67, 78, 89}
index 1 2 3 4 5 6 7 8 9

We would like to look for the number 67,

We first get the median value:
M = (1+9)/2 = 5
A[5] = 50
We disregard the lower half because 50<67.

The lower bound now becomes M+1.
L = M+1 = 5 +1 = 6

The new median now becomes M = (Lower bound + Upper bound)/2
M = (6 + 9) / 2 = 7.5
We round this off so it becomes 8.
A[8] = 78
78>67 so we disregard the upper half.
Since we disregarded the upper half, the new search range would now be from index 6 up to 8. Unlike earlier where we disregarded the lower part, we immediately took the value to the right of the median as the lower bound (L = M+1). This time however, since we disregarded the upper bound, we now get the upper bound instead of the lower bound: U = M-1.
U = 8-1 = 7
Since we already finished comparing with the lower bound 6, and there is no other index to compare, we compare with the upper bound 7.
A[7] = 67?
A[7] = 67 = 67

We now have the answer.


The Marketing Mix

Creating a business requires considering and studying many factors. One of which is marketing. Answers to questions like "how are we going to sell our product?" or "What are we going to sell?" are to be answered. In marketing, there's this thing that we call the Marketing Mix. It's composed of four (4) P's: Product, Price, Promotion, and Place.

Product refers to the goods or services that our business is giving. How are we going to sell if there is nothing to sell? It was said that having a good product will take care of the rest. A good product will promote itself.

Price refers to the strategy on how we give valuation to our product. How much does it cost our customers to acquire the product? It is also important to know this because a wrong pricing strategy will cause us to lose our client base. An overpriced product or service will drive customers away. An under-priced product will create doubts about the product itself or the company selling it.

Promotion refers to how we how we let our customers know about the product or service. Should we use large ads at the mall? Or should we use the newspaper? Many other media are available for this purpose.

Place or Distribution refers to how we let our product reach our customers. Are we into retailing? Is our target located locally? Do we target everyone in the globe and put our product online? Do we focus on adults or children?

Let us try to examine one company: PromoPeddler.com

Product: They are selling promotional products or promotional items and corporate gifts.
Price: Prices vary and are within the market's average.
Promotion: Well, it's quite obvious. They're using the web for promotional purposes.
Place or Distribution: Target market are internet junkies. Buy the product through the web, and the product shall be delivered through courier service.

Conclusion: PromoPeddler.com satisfied the marketing mix. What's left to know is whether or not, their products are sold with the foundation of quality focus.

Whew...

Gee, I missed another review session. PAASCU sure got my attention. It's my second miss for this Philnits review. I also skipped classes on my MIM last Saturday. I hope all of this would be worth the time missed. Now I have a lot to cope with. Hmmm... that's all I can say. Hmmm...

iPod

Apple is really innovative with their products. iPod Nano is just one example. Multimedia at the palm of your hands. Who would have thought of this great idea? The product is not necessarily a necessity, but it is something that everyone would want to have. Currently, there are four types of iPods:
Shuffle (http://www.apple.com/ipodshuffle/),
Features: Controls, Clip, Shuffle switch, Battery Indicator, Headphone Jack.











Nano (http://www.apple.com/ipodnano/),





Features: Music, Videos, Photos, Podcasts, TV Shows, Audio Books, Games, Extras.


Classic (http://www.apple.com/ipodclassic/),


Features: Music, Videos, iTunes Wi-Fi Music Store, App Store, Safari, Mail, Maps, YouTube, photos, calendar, etc.










and Touch (http://www.apple.com/ipodtouch/).






These products are widely available in the market. If you don't have an Apple center near, you can shop online. You can shop for a 4GB Nano, 8GB Nano, 80GB Classic, 160 Classic, etc.

WAAAAR

I hope the war won't last long. It will surely affect the Philippine economy. Those two countries supply oil to the world. For sure, if war continues there, prices will go up. The Filipino people have mediocre incomes and might suffer indirectly. sigh.

Tsk tsk tsk

Gee. no posts for July...