Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 138
Default LEN and Numeric Formula

Hi,

I am trying to identify in a cell if the entry is 6 characters long and the
characters are all numbers, the answer is yes, otherwise no. can you advise
if this is possible?

Many thanks

Paula

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default LEN and Numeric Formula

=AND((LEN(A1)=6),ISNUMBER(A1))
--
Gary''s Student - gsnu200809
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,358
Default LEN and Numeric Formula

This won't handle -12345, or 123.45. If all characters are supposed to be
numbers, then these won't meet the critera. Modifying your formula:
=AND((LEN(SUBSTITUTE(SUBSTITUTE(A1,"-",""),".",""))=6),ISNUMBER(A1))

There is probably an easier way. And of course, I haven't thought about
scientific notation in the cell either. :)
--
** John C **

"Gary''s Student" wrote:

=AND((LEN(A1)=6),ISNUMBER(A1))
--
Gary''s Student - gsnu200809

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 449
Default LEN and Numeric Formula

Question now is if - and . satisfy "characters are all numbers". In other
words why the h and what is this for? A simple =100000 might do in the
stricter understanding of the task.

Best wishes Harald

"John C" <johnc@stateofdenial wrote in message
...
This won't handle -12345, or 123.45. If all characters are supposed to be
numbers, then these won't meet the critera. Modifying your formula:
=AND((LEN(SUBSTITUTE(SUBSTITUTE(A1,"-",""),".",""))=6),ISNUMBER(A1))

There is probably an easier way. And of course, I haven't thought about
scientific notation in the cell either. :)
--
** John C **

"Gary''s Student" wrote:

=AND((LEN(A1)=6),ISNUMBER(A1))
--
Gary''s Student - gsnu200809


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default LEN and Numeric Formula

Good catch! How about if we test the length and also test that each of the
six "characters" is a digit?

First enter this UDF:

Function numeral(v As Variant) As Boolean
numeral = IsNumeric(v)
End Function

and then we can use something like:

=(LEN(A1)=6)*(numeral(MID(A1,1,1)))*(numeral(MID(A 1,2,1)))*(numeral(MID(A1,3,1)))*(numeral(MID(A1,4, 1)))*(numeral(MID(A1,5,1)))*(numeral(MID(A1,6,1)))


This is, admittedly, brute farse!
--
Gary''s Student - gsnu200809


"John C" wrote:

This won't handle -12345, or 123.45. If all characters are supposed to be
numbers, then these won't meet the critera. Modifying your formula:
=AND((LEN(SUBSTITUTE(SUBSTITUTE(A1,"-",""),".",""))=6),ISNUMBER(A1))

There is probably an easier way. And of course, I haven't thought about
scientific notation in the cell either. :)
--
** John C **

"Gary''s Student" wrote:

=AND((LEN(A1)=6),ISNUMBER(A1))
--
Gary''s Student - gsnu200809



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,358
Default LEN and Numeric Formula

I like Gary's UDF idea (I didn't test it mind you :). But the issue with the
=100000 is what if the cell contains 000444?

Perhaps more input from the OP is needed at this point.
--
** John C **

"Harald Staff" wrote:

Question now is if - and . satisfy "characters are all numbers". In other
words why the h and what is this for? A simple =100000 might do in the
stricter understanding of the task.

Best wishes Harald

"John C" <johnc@stateofdenial wrote in message
...
This won't handle -12345, or 123.45. If all characters are supposed to be
numbers, then these won't meet the critera. Modifying your formula:
=AND((LEN(SUBSTITUTE(SUBSTITUTE(A1,"-",""),".",""))=6),ISNUMBER(A1))

There is probably an easier way. And of course, I haven't thought about
scientific notation in the cell either. :)
--
** John C **

"Gary''s Student" wrote:

=AND((LEN(A1)=6),ISNUMBER(A1))
--
Gary''s Student - gsnu200809



  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 138
Default LEN and Numeric Formula

Hi, As it happens the first seemed to work, I think this is because my
numbers are always 999999 pattern, no dots spaces or - numbers as it is a
staff identifier. Can I be greedy with another question. Can I ask can I add
another condition of if another cell equals Z combined with this, I'm trying
and can't seem to get it right?

Thanks for all your help.

Paula


"Gary''s Student" wrote:

Good catch! How about if we test the length and also test that each of the
six "characters" is a digit?

First enter this UDF:

Function numeral(v As Variant) As Boolean
numeral = IsNumeric(v)
End Function

and then we can use something like:

=(LEN(A1)=6)*(numeral(MID(A1,1,1)))*(numeral(MID(A 1,2,1)))*(numeral(MID(A1,3,1)))*(numeral(MID(A1,4, 1)))*(numeral(MID(A1,5,1)))*(numeral(MID(A1,6,1)))


This is, admittedly, brute farse!
--
Gary''s Student - gsnu200809


"John C" wrote:

This won't handle -12345, or 123.45. If all characters are supposed to be
numbers, then these won't meet the critera. Modifying your formula:
=AND((LEN(SUBSTITUTE(SUBSTITUTE(A1,"-",""),".",""))=6),ISNUMBER(A1))

There is probably an easier way. And of course, I haven't thought about
scientific notation in the cell either. :)
--
** John C **

"Gary''s Student" wrote:

=AND((LEN(A1)=6),ISNUMBER(A1))
--
Gary''s Student - gsnu200809

  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 138
Default LEN and Numeric Formula

Hi,

The first formula seemed to work, I think this is because my numbers are
always 999999 - no dots, spaces or - numbers, I am now trying to attach
another condition of IF cell E19 = Z it would also be true...

So I would want all 6 numerics in one cell to be true, but also even if that
cell was not 6 numberic if the cell in another column = Z it would still be
true?

I cant quite get to the right formula...

Paula


"Gary''s Student" wrote:

Good catch! How about if we test the length and also test that each of the
six "characters" is a digit?

First enter this UDF:

Function numeral(v As Variant) As Boolean
numeral = IsNumeric(v)
End Function

and then we can use something like:

=(LEN(A1)=6)*(numeral(MID(A1,1,1)))*(numeral(MID(A 1,2,1)))*(numeral(MID(A1,3,1)))*(numeral(MID(A1,4, 1)))*(numeral(MID(A1,5,1)))*(numeral(MID(A1,6,1)))


This is, admittedly, brute farse!
--
Gary''s Student - gsnu200809


"John C" wrote:

This won't handle -12345, or 123.45. If all characters are supposed to be
numbers, then these won't meet the critera. Modifying your formula:
=AND((LEN(SUBSTITUTE(SUBSTITUTE(A1,"-",""),".",""))=6),ISNUMBER(A1))

There is probably an easier way. And of course, I haven't thought about
scientific notation in the cell either. :)
--
** John C **

"Gary''s Student" wrote:

=AND((LEN(A1)=6),ISNUMBER(A1))
--
Gary''s Student - gsnu200809

  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default LEN and Numeric Formula

=OR(AND((LEN(A1)=6),ISNUMBER(A1)),(E1="Z"))

So even if A1 is not quite good enough, E1 can save the day!

--
Gary''s Student - gsnu200809
  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,358
Default LEN and Numeric Formula

Look, up in the sky, it's a bird, it's a plane, it's E1man! (or E1woman :)
--
** John C **

"Gary''s Student" wrote:

=OR(AND((LEN(A1)=6),ISNUMBER(A1)),(E1="Z"))

So even if A1 is not quite good enough, E1 can save the day!

--
Gary''s Student - gsnu200809



  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default LEN and Numeric Formula

Perhaps a new superhero!
--
Gary''s Student - gsnu200809


"John C" wrote:

Look, up in the sky, it's a bird, it's a plane, it's E1man! (or E1woman :)
--
** John C **

"Gary''s Student" wrote:

=OR(AND((LEN(A1)=6),ISNUMBER(A1)),(E1="Z"))

So even if A1 is not quite good enough, E1 can save the day!

--
Gary''s Student - gsnu200809

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
Find and Return Numeric Label based on (Numeric Value) Criterion Sam via OfficeKB.com Excel Worksheet Functions 2 September 18th 06 11:20 PM
Find Numeric Criterion in Column & Return the Numeric Value from Row above Sam via OfficeKB.com Excel Worksheet Functions 6 April 27th 06 02:50 PM
Numeric in Text to convert back to the form of Numeric for VLookup Purposes achilles Excel Discussion (Misc queries) 4 February 6th 06 07:05 AM
Match Single Numeric Criteria and Return Multiple Numeric Labels Sam via OfficeKB.com Excel Worksheet Functions 3 December 30th 05 08:01 PM
Match Single Numeric Criteria and Return Multiple Numeric Labels Sam via OfficeKB.com Excel Worksheet Functions 0 December 29th 05 08:44 PM


All times are GMT +1. The time now is 03:53 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"