Last text word to be manipulated

nutrastat

Board Regular
Joined
Nov 1, 2008
Messages
57
Having now worked, unsuccessfully, for the last 4 hours on a formula, I am wondering whether anyone can now help.

In cell A1 we need to check for the word "DECK" as the 1st four characters, if this is TRUE then we MAY need to amend it in cell A4. If it says DECK 1, DECK 2, DECK 3 and so on to DECK 9, then we need to put a 0 (zero) in the front of the number (i.e. DECK 01, DECK 02 and so on). However, if it says DECK 13, then we do not need to zero (this is all about a sorting problem).

Unfortunately, the bit that I am finding difficult, is that some Decks do not have numbers, they may be called DECK A, or DECK B, and, to make it even harder it may be called DECK AZURE, DECK BATA and these will NOT need a zero in front.

Can anyone help?
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Beaten to it but what the hey

=IF(AND(ISNUMBER(SUBSTITUTE(A1,"DECK ","")+0),LEN(SUBSTITUTE(A1, "DECK ", ""))=1), "DECK 0" &SUBSTITUTE(A1,"DECK ",""), A1)

Not nearly as elegant ;)
 
Upvote 0
Many thanks for such a prompt response. I will now try to look at your solution to find out how it works, as I have never used number & replace functions before; which is why I probably had so many difficulties.

Best regards,

Graham
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top