ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   deleting characters (https://www.excelbanter.com/excel-programming/333617-deleting-characters.html)

PLPE[_12_]

deleting characters
 

Hi,

I would like to be able to delete some characters from some cells.

I want to look for 4 spaces, then delete everything after (and
including) the 4 spaces.



This is probably staring me in the face

Thanks.


--
PLPE
------------------------------------------------------------------------
PLPE's Profile: http://www.excelforum.com/member.php...o&userid=23856
View this thread: http://www.excelforum.com/showthread...hreadid=384473


mangesh_yadav[_361_]

deleting characters
 

=IF(ISERR(LEFT(A1,FIND(" ",A1)-1)),A1,LEFT(A1,FIND(" ",A1)-1))

considering your test is in A1.

Mangesh


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=384473


Tom Ogilvy

deleting characters
 
If you are looking for a VBA solution:

Sub ProcStrings()
Dim cell as Range, iloc as Long
for each cell in selection
iloc = instr(1,cell.Value, " ",vbTextCompare)
if iloc 1 then
cell.Value = Left(cell.Value,iloc-1)
else
cell.Value = Trim(cell.Value)
end if
Next
End sub

--
Regards,
Tom Ogilvy



"PLPE" wrote in message
...

Hi,

I would like to be able to delete some characters from some cells.

I want to look for 4 spaces, then delete everything after (and
including) the 4 spaces.



This is probably staring me in the face

Thanks.


--
PLPE
------------------------------------------------------------------------
PLPE's Profile:

http://www.excelforum.com/member.php...o&userid=23856
View this thread: http://www.excelforum.com/showthread...hreadid=384473




PLPE[_13_]

deleting characters
 

brilliant, thanks to both of you for your help.

I'll be going with the VB code.


--
PLPE
------------------------------------------------------------------------
PLPE's Profile: http://www.excelforum.com/member.php...o&userid=23856
View this thread: http://www.excelforum.com/showthread...hreadid=384473


PLPE[_14_]

deleting characters
 

I've tried the VB code, but to no avail.
I now want to look for 2 consecutive spaces.
When they are found, I want to delete them & everything following
after.

I'd prefere to do this using code, rather than a cell formula - I'll
have formulae in the cells at a later stage.

any ideas?


--
PLPE
------------------------------------------------------------------------
PLPE's Profile: http://www.excelforum.com/member.php...o&userid=23856
View this thread: http://www.excelforum.com/showthread...hreadid=384473



All times are GMT +1. The time now is 09:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com