Announcement

Collapse
No announcement yet.

Assigning Numerical Values in Letters

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Assigning Numerical Values in Letters

    Is it possible once you have assigned letter a numerical value (example: A = 1, B = 2) add them together?
    (example: AB = 3)

    Here is the file what i trying to do

    If it is possible, it would help me a fortune
    Attached Files

  • #2
    Re: Assigning Numerical Values in Letters

    Perhaps if you explain this in context... but maybe

    Code:
    Sub x()
    
        Dim a As Integer
        Dim b As Integer
         
        a = 2
        b = 1
        
        MsgBox a + b & "project.xls"
    
    End Sub

    Comment


    • #3
      Re: Assigning Numerical Values in Letters

      Dear cytop,

      First of all im very great full for ur reply but this is not im trying to do, didn't you cheek the attach file, this is for my project, i did try but wasn't successful.

      Comment


      • #4
        Re: Assigning Numerical Values in Letters

        ...didn't you cheek the attach file
        No, I didn't check the file... not for any reason other than I'm using an Android Pad at the moment.

        You'll generally find you'll get more timely, and more accurate, replies when you describe your issue in your post. Some users can't, and some are unwilling, to download files. Even if I was using a Windows machine, I don't generally go to the bother of downloading a file, running it through a virus checker (no offence - it's just a sensible thing to do), opening it in Excel to view/read your problem only to find I can't help.

        Comment


        • #5
          Re: Assigning Numerical Values in Letters

          Using a lookup range it can be done - see attached.

          I used a column down to 255 rows (you can use less if you know your word length is less).
          Lookup the Nth character (based on Nth row) and return the value of that character from the hlookup table.
          Then add up the lookup column.
          Attached Files

          Comment


          • #6
            Re: Assigning Numerical Values in Letters

            VBA

            To Sheet1 code module
            Code:
            Private Sub Worksheet_Change(ByVal Target As Range)
                Dim i As Long
                With Target
                    If .Address(0, 0) = "B4" Then
                        Application.EnableEvents = False
                        .Offset(, -1).ClearContents
                        If Not .Value Like "*[!a-z]*" Then
                            For i = 1 To Len(.Value)
                                .Offset(, -1).Value = .Offset(, -1).Value + _
                                Application.HLookup(Mid$(.Value, i, 1), Range("b2:aa3"), 2, True)
                            Next
                        End If
                        Application.EnableEvents = True
                    End If
                End With
            End Sub

            Comment

            Working...
            X