logo elektroda
logo elektroda
X
logo elektroda

[Excel] Automatic Insertion of / Between Characters in Cells - 5000 rows, 2nd & 3rd Characters

MrGrzechoo 56056 3
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 8614674
    MrGrzechoo
    Level 10  
    Hello,
    please help as you can automatically insert a character in selected cells between the data already entered in the cell. I have about 5,000 lines, and for each line I want to put a "/" in the space between the second and third letters or a digit (character) from the right. It would look like this:
    abcd1234 -> adcd12 / 34
    cdefghijk -> cdefghi / jk
    The "/" sign should always be inserted in the same place (i.e. between the 2nd and 3rd characters from the right)
    How can this be solved in Excel (2003 or 2007)?
    Can you do something like this automatically at all?
  • ADVERTISEMENT
  • Helpful post
    #2 8615142
    adamas_nt
    Moderator of Programming
    Insert new column, paste function (example for source column A from 1 row)
    =FRAGMENT.TEKSTU(A1;1;DŁ(A1)-2)&"/"&PRAWY(A1;2)
    and drag down. Then select the column, Copy, Paste Special> Values and delete the source column.
    The same function can be used in a VBA loop (mid, len, right). It's worth it if the activity is repeated ...
  • ADVERTISEMENT
  • Helpful post
    #3 8615421
    Januszf777
    Level 27  
    Hello, same solution in a slightly different way, skipping the error for cell voids:
    = IF (A1 = ""; ""; LEFT (A1, LEN (A1) -2) & "/" & RIGHT (A1; 2))
  • #4 8617651
    MrGrzechoo
    Level 10  
    Thanks for the solution. Works great. Now I will try to figure out vba to make the inserting process a bit easier.
    Rispekt for adamas_nt and Januszf777
    That's what I meant.
    best regards
ADVERTISEMENT