Skip to content
The Chat Archive
claude-3-5-haiku-20241022· Anthropic LMArena Human Preference 140K

excel formula to get value 'xxx' for current cell if 1st digit of another certain cell…

  1. User

    excel formula to get value 'xxx' for current cell if 1st digit of another certain cell is 3 and 'yyy' if the 1st digit is 2

  2. Assistant

    I'll help you create an Excel formula for this scenario. Here's a formula using the IF and LEFT functions:

    =IF(LEFT(ReferenceCellAddress,1)="3","xxx",IF(LEFT(ReferenceCellAddress,1)="2","yyy",""))
    

    Let me break this down:

    • LEFT(ReferenceCellAddress,1) extracts the first digit of the reference cell
    • The first IF checks if the first digit is "3" and returns "xxx" if true
    • The nested IF then checks if the first digit is "2" and returns "yyy" if true
    • If neither condition is met, it returns an empty string

    Example:

    • If A1 contains 345, the formula would return "xxx"
    • If A1 contains 245, the formula would return "yyy"
    • If A1 contains 145, the formula would return "" (blank)

    Replace ReferenceCellAddress with the actual cell reference you're checking, like A1 or B2.

    Would you like me to elaborate on any part of the formula?

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