Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10
Default validation with two specific formats

Hi there,

How do you make sure certain character will be showing up on Excel cell,
e.g. R123456. The first letter must be S and followed by 6 numbers?

I have come up with formula: =AND(LEFT(A1, 1)="R", LEN(A1)=7), which is not
perfect because it will accept, e.g. R65432S.

Any advice?

--
Aline Yiu
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default validation with two specific formats

Try something like this:

Select the cells to be impacted, with A1 as the active cell

From the Excel main menu:
<data<validation
Allow: Custom
Formula: =AND(COUNTIF(A1,"R??????"),MOD(RIGHT(A1,6),1)=0,--RIGHT(A1,6)=0)

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

XL2002, WinXP


"Aline Yiu" wrote:

Hi there,

How do you make sure certain character will be showing up on Excel cell,
e.g. R123456. The first letter must be S and followed by 6 numbers?

I have come up with formula: =AND(LEFT(A1, 1)="R", LEN(A1)=7), which is not
perfect because it will accept, e.g. R65432S.

Any advice?

--
Aline Yiu

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default validation with two specific formats

Actually, there's a flaw in my posted formula...

it allowed an entry like this: R1234.0

Try this, instead:
=AND(COUNTIF(A1,"R??????"),COUNTIF(A1,"*.*")=0,MOD (RIGHT(A1,6),1)=0,--RIGHT(A1,6)=0)

Note: That formula still allows a lowercase "r". If that is an issue,
then maybe this?:
=AND(COUNTIF(A1,"R??????"),EXACT(LEFT(A1,1),"R"),C OUNTIF(A1,"*.*")=0,MOD(RIGHT(A1,6),1)=0,--RIGHT(A1,6)=0)

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

XL2002, WinXP


"Ron Coderre" wrote:

Try something like this:

Select the cells to be impacted, with A1 as the active cell

From the Excel main menu:
<data<validation
Allow: Custom
Formula: =AND(COUNTIF(A1,"R??????"),MOD(RIGHT(A1,6),1)=0,--RIGHT(A1,6)=0)

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

XL2002, WinXP


"Aline Yiu" wrote:

Hi there,

How do you make sure certain character will be showing up on Excel cell,
e.g. R123456. The first letter must be S and followed by 6 numbers?

I have come up with formula: =AND(LEFT(A1, 1)="R", LEN(A1)=7), which is not
perfect because it will accept, e.g. R65432S.

Any advice?

--
Aline Yiu

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,393
Default validation with two specific formats

Try =AND(LEFT(A1)="R",ISNUMBER(--RIGHT(A1,6)))
I hope I read your question correctly (you seem to want an R not an S)
Not my formula will accept lower case r.
This accepts only uppercase
=AND(EXACT(LEFT(A1),"R"),ISNUMBER(--RIGHT(A1,6)))
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Aline Yiu" wrote in message
...
Hi there,

How do you make sure certain character will be showing up on Excel cell,
e.g. R123456. The first letter must be S and followed by 6 numbers?

I have come up with formula: =AND(LEFT(A1, 1)="R", LEN(A1)=7), which is
not
perfect because it will accept, e.g. R65432S.

Any advice?

--
Aline Yiu



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10
Default validation with two specific formats

Thank you so much. It works! You are very smart. Wondering where did you
learn all this.

I noticed that "--" before "RIGHT(A1,6)" is a must, why is that.

Thanks,
--
Aline Yiu


"Bernard Liengme" wrote:

Try =AND(LEFT(A1)="R",ISNUMBER(--RIGHT(A1,6)))
I hope I read your question correctly (you seem to want an R not an S)
Not my formula will accept lower case r.
This accepts only uppercase
=AND(EXACT(LEFT(A1),"R"),ISNUMBER(--RIGHT(A1,6)))
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Aline Yiu" wrote in message
...
Hi there,

How do you make sure certain character will be showing up on Excel cell,
e.g. R123456. The first letter must be S and followed by 6 numbers?

I have come up with formula: =AND(LEFT(A1, 1)="R", LEN(A1)=7), which is
not
perfect because it will accept, e.g. R65432S.

Any advice?

--
Aline Yiu






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
Data validation dakotasteve Excel Worksheet Functions 13 August 5th 06 01:28 AM
data validation mattdsc Excel Worksheet Functions 4 July 26th 06 11:30 AM
Dependent Validation in SharePoint-synchronised list Simon Alcock Excel Discussion (Misc queries) 0 July 5th 06 10:21 AM
Data validation with hyperlinks [email protected] Excel Worksheet Functions 1 June 8th 06 07:34 PM
Data Validation Window? Ken Excel Discussion (Misc queries) 1 January 11th 05 10:48 PM


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