Skip to content
TheChatArchiveThe Chat Archive
Qwenqwen3-30b-a3b· Alibaba (Qwen)Hugging Face LMArena Human Preference 140K

Write an Excel function to return ROT13'd text from A1 and put it into B1.

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Claudeclaude-3-7-sonnet-20250219-thinking-32k’s answer.
  1. User

    Write an Excel function to return ROT13'd text from A1 and put it into B1.

  2. Qwen Assistant

    To apply the ROT13 cipher to the text in cell A1 and return the result in B1, you can use a VBA (Visual Basic for Applications) function. This is the most efficient and straightforward method in Excel, as the ROT13 algorithm involves character-by-character transformations that are not easily achievable using standard Excel formulas alone.


    ✅ Step-by-Step Instructions

    1. Open the VBA Editor:

      • Press Alt + F11 to open the VBA editor.
      • In the menu, go to Insert > Module to create a new module.
    2. Paste the Following VBA Code:

    Function ROT13(text As String) As String
        Dim i As Integer
        Dim char As String
        Dim result As String
        Dim code As Integer
    
        For i = 1 To Len(text)
            char = Mid(text, i, 1)
            code = Asc(char)
    
            If (char >= "A" And char <= "Z") Then
                ' Uppercase
                code = (code - 65 + 13) Mod 26 + 65
                result = result & Chr(code)
            ElseIf (char >= "a" And char <= "z") Then
                ' Lowercase
                code = (code - 97 + 13) Mod 26 + 97
                result = result & Chr(code)
            Else
                ' Non-alphabetic characters remain unchanged
                result = result & char
            End If
        Next i
    
        ROT13 = result
    End Function
    
    1. Return to Excel and Use the Function:
      • In cell B1, enter the formula:
        =ROT13(A1)
        

    🧠 How It Works

    • The ROT13 function iterates through each character in the input string.
    • It checks whether the character is uppercase or lowercase.
    • It applies the ROT13 transformation using modular arithmetic to ensure proper wrapping around the alphabet (e.g., Z becomes M).
    • Non-alphabetic characters (like spaces, numbers, or symbols) are left unchanged.

    📌 Example

    A1B1
    "Hello""Uryyb"
    "World""Jbeyq"
    "Excel!""Rkcvq!"

    📝 Notes

    • This function works in all versions of Excel that support VBA (e.g., Excel 2007 and later).
    • If you're using Excel 365 or Excel 2021, you could also achieve this using a formula-based approach with TEXTJOIN, SEQUENCE, and MID. However, the VBA solution is more readable and efficient for this purpose.

    ✅ Final Answer

    To return the ROT13'd text from A1 into B1, use the following VBA function:

    Function ROT13(text As String) As String
        Dim i As Integer
        Dim char As String
        Dim result As String
        Dim code As Integer
    
        For i = 1 To Len(text)
            char = Mid(text, i, 1)
            code = Asc(char)
    
            If (char >= "A" And char <= "Z") Then
                code = (code - 65 + 13) Mod 26 + 65
            ElseIf (char >= "a" And char <= "z") Then
                code = (code - 97 + 13) Mod 26 + 97
            End If
    
            result = result & Chr(code)
        Next i
    
        ROT13 = result
    End Function
    

    Then, in cell B1, enter:

    =ROT13(A1)
    

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.