Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 5
Default Parsing excel field help !

Does any know how can I check all the characters of a field and check
that there is not an alphanumeric character (a-z) and if there is one
changing to zero.

Ex. 5J00 = would like to change it to 5000.
20A5 = would like to change it to 2005.

Thank you.

Luis

  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 10,124
Default Parsing excel field help !

try

Sub changecharactertozero()
For Each c In Selection
For i = 1 To Len(c)
If Not IsNumeric(Mid(c, i, 1)) Then c.Replace Mid(c, i, 1), "0"
Next i
Next c
End Sub

--
Don Guillett
SalesAid Software

wrote in message
ps.com...
Does any know how can I check all the characters of a field and check
that there is not an alphanumeric character (a-z) and if there is one
changing to zero.

Ex. 5J00 = would like to change it to 5000.
20A5 = would like to change it to 2005.

Thank you.

Luis



  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 2,118
Default Parsing excel field help !

If the test cell will ALWAYS be 4 characters,
this formula works:

With
A1: (4 character value)

B1:
=IF(ISERR(--MID(A1,1,1)),"0",MID(A1,1,1))&IF(ISERR(--MID(A1,2,1)),"0",MID(A1,2,1))&IF(ISERR(--MID(A1,3,1)),"0",MID(A1,3,1))&IF(ISERR(--MID(A1,4,1)),"0",MID(A1,4,1))

Does that help?
***********
Regards,
Ron

XL2002, WinXP


" wrote:

Does any know how can I check all the characters of a field and check
that there is not an alphanumeric character (a-z) and if there is one
changing to zero.

Ex. 5J00 = would like to change it to 5000.
20A5 = would like to change it to 2005.

Thank you.

Luis


  #4   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 3,718
Default Parsing excel field help !

Try this:

=SUBSTITUTE(A1,MID(A1,MATCH(FALSE,ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)),0),1),0)

ctrl+shift+enter, not just enter



" wrote:

Does any know how can I check all the characters of a field and check
that there is not an alphanumeric character (a-z) and if there is one
changing to zero.

Ex. 5J00 = would like to change it to 5000.
20A5 = would like to change it to 2005.

Thank you.

Luis


  #5   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 2,118
Default Parsing excel field help !

Caveat.....works if there is only one non-numeric or, if more than one, they
are the same character.

Works for 5AA5
Fails for 5AB5

***********
Regards,
Ron

XL2002, WinXP


"Teethless mama" wrote:

Try this:

=SUBSTITUTE(A1,MID(A1,MATCH(FALSE,ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)),0),1),0)

ctrl+shift+enter, not just enter



" wrote:

Does any know how can I check all the characters of a field and check
that there is not an alphanumeric character (a-z) and if there is one
changing to zero.

Ex. 5J00 = would like to change it to 5000.
20A5 = would like to change it to 2005.

Thank you.

Luis




  #6   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 2,118
Default Parsing excel field help !

Here's a shorter alternative:

With
A1: (the test value)

=SUMPRODUCT(IF(ISNUMBER(--MID(A1,{1,2,3,4},1)),MID(A1,{1,2,3,4},1))*{1000,10 0,10,1})

Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"Ron Coderre" wrote:

If the test cell will ALWAYS be 4 characters,
this formula works:

With
A1: (4 character value)

B1:
=IF(ISERR(--MID(A1,1,1)),"0",MID(A1,1,1))&IF(ISERR(--MID(A1,2,1)),"0",MID(A1,2,1))&IF(ISERR(--MID(A1,3,1)),"0",MID(A1,3,1))&IF(ISERR(--MID(A1,4,1)),"0",MID(A1,4,1))

Does that help?
***********
Regards,
Ron

XL2002, WinXP


" wrote:

Does any know how can I check all the characters of a field and check
that there is not an alphanumeric character (a-z) and if there is one
changing to zero.

Ex. 5J00 = would like to change it to 5000.
20A5 = would like to change it to 2005.

Thank you.

Luis


  #7   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 266
Default Parsing excel field help !

skrev i en meddelelse
ps.com...
Does any know how can I check all the characters of a field and check
that there is not an alphanumeric character (a-z) and if there is one
changing to zero.

Ex. 5J00 = would like to change it to 5000.
20A5 = would like to change it to 2005.

Thank you.

Luis


Luis

Here's a generic array formula. It will work for
an arbitrary number of characters in the cell and
for an arbitrary number of non-numeric characters.

=SUM(IF(ISERROR(MID(A1,ROW(INDIRECT("1:"&LEN(A1))) ,1)+0),0,
MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))*10^(LEN(A1)-ROW(INDIRECT("1:"&LEN(A1)))))

To be confirmed with <Shift<Ctrl<Enter, also if edited later.

--
Best regards
Leo Heuser

Followup to newsgroup only please.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Excel 2000 VBA Application on Excel 2003 Excel Worksheet Functions 0 August 8th 06 02:36 AM
Copy the "Title" Field from windows explorer to excel? [email protected] New Users to Excel 1 June 30th 06 09:58 PM
Export memo field in Access to Excel - data gets cut off cpurpleturtle Excel Discussion (Misc queries) 0 June 22nd 06 04:24 PM
Multiple Excel versions. Naveen Mukkelli Excel Discussion (Misc queries) 0 May 16th 06 12:55 AM
Problems with Pivot Table Field Sorting in Excel 2002 Phoenix71555 Excel Discussion (Misc queries) 1 February 27th 05 11:25 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"