Consulting

Results 1 to 7 of 7

Thread: Formula help please

  1. #1

    Formula help please

    Using this formula in cell C2

    =REPLACE(B2,FIND("B",B2),LEN("B"),"C")

    gives the result of C (in C2) if theres a B (in B2)

    I also want to get a result of D in C2 if theres an I in B2 so

    =REPLACE(B2,FIND("I",B2),LEN("I"),"D")

    Both work separately but can't figure how to nest the 2 functions together

    help please - or is there another easier way to get the same result?

    many thanks
    Jon

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Jon, I don't trust your explanation. Do me a favor and copy the working formula from the Formula Bar and paste it directly into the post.

    See clear contents of adjacent cell(s) on for reason.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,060
    Location
    Just guessing here but try;

    =Replace(B2,Find(Or("B",B2),Len("B"),"C"),("I",B2)Len("I"),"D")
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  4. #4
    Hi Guys,

    Copied from formula bar

    =REPLACE(B2,FIND("B",B2),LEN("B"),"C") & =REPLACE(B3,FIND("I",B3),LEN("I"),"D")

    Can’t get your formula to work Aussie but thanks for trying

    The contents of B2 would always be a single letter either B or I

    thanks
    Jon
    Last edited by blackie42; 12-09-2014 at 05:07 AM.

  5. #5
    Solution...

    =SUBSTITUTE(SUBSTITUTE(B2,"B","C"),"I","D")

    thanks for your help guys
    regards
    Jon

  6. #6
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    =IF(B2="B","C","D")
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  7. #7
    Hi Sam,

    It really was simple in the end - I use these types of IF statements regularly and it never clicked. Getting Old!

    Thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •