Excel formula to rearrange the cell contents ENG/DEF/001/14 to ENG/DEF/14/001

HelenL

New Member
Joined
Nov 17, 2008
Messages
26
Excel formula to rearrange the cell contents ENG/DEF/001/14 to ENG/DEF/14/001

Help appreciated - completely lost! :LOL:
 

Some videos you may like

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

sandy666

Well-known Member
Joined
Oct 24, 2015
Messages
5,831
with PowerQuery (Get&Transform)

rawresult
ENG/DEF/001/14ENG/DEF/14/001

Code:
[SIZE=1]// Table1
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Split = Table.SplitColumn(Source, "raw", Splitter.SplitTextByAnyDelimiter({"/"}, QuoteStyle.Csv)),
    Merge = Table.CombineColumns(Split,{"raw.1", "raw.2", "raw.4", "raw.3"},Combiner.CombineTextByDelimiter("/", QuoteStyle.None),"result")
in
    Merge[/SIZE]
 
Last edited:

ClaireS

Board Regular
Joined
Jul 29, 2013
Messages
137
Or just [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]=LEFT(A1,8)&MID(A1,13,2)&"/"&MID(A1,9,3) where A1 is the cell containing your source string.[/FONT]
 

kweaver

Well-known Member
Joined
May 8, 2018
Messages
1,074
Office Version
365, 2010
With your original text in A1, here's an ugly formula for B1 that will make the switch:

Code:
=LEFT(A1,FIND(CHAR(1),SUBSTITUTE(A1,"/",CHAR(1),2)))&RIGHT(A1,LEN(A1)-FIND(CHAR(1),SUBSTITUTE(A1,"/",CHAR(1),3)))&MID(A1,FIND(CHAR(1),SUBSTITUTE(A1,"/",CHAR(1),2)),FIND(CHAR(1),SUBSTITUTE(A1,"/",CHAR(1),3))-FIND(CHAR(1),SUBSTITUTE(A1,"/",CHAR(1),2)))
This one assumes the length of the characters between the slashes might vary.
 
Last edited:

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,043
Office Version
2010
Platform
Windows
Excel formula to rearrange the cell contents ENG/DEF/001/14 to ENG/DEF/14/001
There are several ways to do this, some way more efficient than others but which might depend on the structure of your data, so I have some questions.

1) Is this for a single cell (which one) or a column of cells (which column and start row)?

2) Is the first field (the ENG) always 3 characters long?

3) Is the second field (the DEF) always 3 characters long?

4) Is the third field (the 001) always 3 digits long?

5) Is the last field (the 14) always 2 digits long (meaning single digit numbers have leading zeros in order to make it 2 digits long)?

6) Are you trying to physically change your data to this revised format directly within their cells (so if your example was in cell A1, the revised text would end up in cell A1)?
 

HelenL

New Member
Joined
Nov 17, 2008
Messages
26
1) single cell A1 Row 2 but will pull the formula down through the rest
2) yes
3) yes
4) yes
5)yes this is the year
6) yes

Thank you !
 
Last edited:

HelenL

New Member
Joined
Nov 17, 2008
Messages
26
Thank you so much that brilliant. works a treat !
 

Watch MrExcel Video

Forum statistics

Threads
1,102,620
Messages
5,487,902
Members
407,614
Latest member
fuslela

This Week's Hot Topics

  • Timer in VBA - Stop, Start, Pause and Reset
    [CODE=vba][/CODE] Option Explicit Dim CmdStop As Boolean Dim Paused As Boolean Dim Start Dim TimerValue As Date Dim pausedTime As Date Sub...
  • how to updates multiple rows in muliselect listbox
    Hello everyone. I need help with below code. code is only chaning 1st row in mulitiselect list box. i know issue with code...
  • Delete Row from Table
    I am trying to delete a row from a table using VBA using a named range to find what I need to delete. My Range is finding the right cell. In the...
  • Assigning to a variable
    I have a for each block where I want to assign the value in column 5 of the found row to the variable Serv. [CODE=vba] For Each ws In...
  • Way to verify information
    Hi All, I don't know what to call this formula, and therefore can't search. I have a spreadsheet with information I want to reference...
  • Active Cell Address – Inactive Sheet
    How to use VBA to get the cell address of the active cell in an inactive worksheet and then place that cell address in a location on the current...
Top