r/excel • u/man-teiv 226 • Feb 13 '18
User Defined Function I've made the =NATO() function, converting any given string into Nato phonetic alphabet!
I was wondering if such a thing existed and I realized I needed it in my life. I'm sure there are thousands of ways to improve it, so feel free to correct me on it! (EDIT: a much better version is shown in the comments)
Option Explicit
Function NATO(command As String)
Dim i#
Dim word As String
NATO = ""
For i = 1 To Len(command)
Select Case LCase(Mid(command, i, 1))
Case " "
word = ""
Case "a"
word = "Alfa"
Case "b"
word = "Bravo"
Case "c"
word = "Charlie"
Case "d"
word = "Delta"
Case "e"
word = "Echo"
Case "f"
word = "Foxtrot"
Case "g"
word = "Golf"
Case "h"
word = "Hotel"
Case "i"
word = "India"
Case "j"
word = "Juliett"
Case "k"
word = "Kilo"
Case "l"
word = "Lima"
Case "m"
word = "Mike"
Case "n"
word = "November"
Case "o"
word = "Oscar"
Case "p"
word = "Papa"
Case "q"
word = "Quebec"
Case "r"
word = "Romeo"
Case "s"
word = "Sierra"
Case "t"
word = "Tango"
Case "u"
word = "Uniform"
Case "v"
word = "Victor"
Case "w"
word = "Whiskey"
Case "x"
word = "X-ray"
Case "y"
word = "Yankee"
Case "z"
word = "Zulu"
End Select
NATO = NATO & word & " "
Next i
End Function
131
Upvotes
View all comments
Show parent comment
1
u/JPDVP 48 Feb 13 '18
2.5 years old laptop (I would consider mid range when bought) i7 as well (dont exactly the model)
Running O365 64 bit (maybe that is the difference?)
I tested 4 times (couldn't be bothered) and got always similar results