Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

manipulating data mid left

Forum home » Delegate support and help forum » Microsoft Excel Training and help » Manipulating Data (mid, left, substitute functions.

Manipulating Data (mid, left, substitute functions.

ResolvedVersion 2003

Gareth has attended:
Excel VBA Intro Intermediate course
Excel Intermediate course
Excel Advanced course

Manipulating Data (mid, left, substitute functions.

Hi

im looking to manipulate some data within a cell.

In cell B2 I have a number.

42JD0128508

Using the formula below I can manipulate the data to

=LEFT(B3,4)&"/" & MID(B3,6,4)&"/" & RIGHT(B3,2)

42JD/1285/08

However I need to add something to my formula that would replace or remove the 6th character of the text if this was a "0"

The above example has "1" so thats no problem however if that number was a "0" it would cause problems and hence I would like to get rid of it.

Any help?


Thanks in advance.

Gareth

RE: Manipulating Data (mid, left, substitute functions.

Hi Gareth

Thank you for your question.

On the surface this looks like a situation where you might use an IF function - the question is, if the 0 was to be replaced (as you refer to it being replaced or removed), what would it be replaced with?

Kind regards
Amanda

RE: Manipulating Data (mid, left, substitute functions.

Gareth,

Thinking about this a bit more, would it always be the case that the 5th and 6th are both zeroes? In which case could you use the Replace feature to replace 00 with 0?

Amanda

RE: Manipulating Data (mid, left, substitute functions.

Amanda

Thanks for your reply.


I managed to find a solution that does exactly what I am after. Below is the formula that I have used, the IF function was the solution

=LEFT(B3,4)&"/"&IF(MID(B3,6,1)="0",MID(B3,7,3),MID(B3,6,4))&"/"&RIGHT(B3,2)

Thanks again.

Excel tip:

Recovering Unsaved Work in Excel 2010

Ever closed your Excel workbook in a hurry without saving your work beforehand? Here's how to get it back.

Choose File then Info, click Manage Versions and then Recover Unsaved Workbooks which will automatically find the spreadsheets that haven't been saved.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.12 secs.