Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
You've changed the rules a bit from the first posting, but here is a
UDF to do what you asked for in your later post: Function txt_num(my_name As String) ' Pete Ashurst, 29/03/2006 ' Dim my_num As Long Dim i As Long Dim char As Long txt_num = 0 If Len(my_name) = 0 Then Exit Function my_name = LCase(my_name) my_num = 0 For i = 1 To Len(my_name) char = Asc(Mid(my_name, i, 1)) If char < 97 Or char 122 Then Exit Function my_num = my_num + ((char - 97) Mod 9 + 1) Next i my_num = Int(my_num / 1000) + Int(my_num / 100) _ + Int(my_num / 10) + my_num Mod 10 txt_num = Int(my_num / 10) + my_num Mod 10 End Function Type your name into A1 and use this formula in B1: =txt_num(A1) The formula can be copied down for as many names as you have in column A. The UDF will return 0 if you have any characters other than A to Z or a to z or if there is nothing in the corresponding cell of column A. Hope this is what you wanted. Pete |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Change cell color if it is the lowest number of a group? | Excel Discussion (Misc queries) | |||
Change number when you open the excel template | Excel Discussion (Misc queries) | |||
adding a number to every change in value | Excel Discussion (Misc queries) | |||
Count number of cells that contain a certain letter - Case Sensitive | Excel Discussion (Misc queries) | |||
How do I change the invoice number assigned in Invoice template... | Excel Discussion (Misc queries) |