Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default return value based on number of characters in cell / field

I have a field with varying number of characters, I need function that
returns a value based on the number of characters in field.

ie if field x <2 characters = 1 2 characters = 2

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,651
Default return value based on number of characters in cell / field

Use the LEN function. Look it up in Excel help.
--
David Biddulph

"Perplexed" wrote in message
...
I have a field with varying number of characters, I need function that
returns a value based on the number of characters in field.

ie if field x <2 characters = 1 2 characters = 2

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default return value based on number of characters in cell / field

How about exactly 2 chars?

=MAX(IF(LEN(A1)=2,2),1) returns 1 if <2 otherwise returns 2


Gord Dibben MS Excel MVP

On Wed, 10 Dec 2008 11:47:00 -0800, Perplexed
wrote:

I have a field with varying number of characters, I need function that
returns a value based on the number of characters in field.

ie if field x <2 characters = 1 2 characters = 2

Thanks


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,934
Default return value based on number of characters in cell / field

Here is one more formula for you to consider...

=1+(LEN(A1)=2)

You didn't define what should happen if there are exact two characters in
the cell, so I treated it the same as when there are more than two
characters in the cell. If that is wrong, just change the = to by itself.

--
Rick (MVP - Excel)


"Perplexed" wrote in message
...
I have a field with varying number of characters, I need function that
returns a value based on the number of characters in field.

ie if field x <2 characters = 1 2 characters = 2

Thanks


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default return value based on number of characters in cell / field

Hi

=MIN(LEN(A4),2)

However, since you didn't tell us what to do if len=2, I choose to treat it
as =2

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Perplexed" wrote:

I have a field with varying number of characters, I need function that
returns a value based on the number of characters in field.

ie if field x <2 characters = 1 2 characters = 2

Thanks

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
LIMIT THE NUMBER OF CHARACTERS ENTERED IN A FIELD RichN Excel Worksheet Functions 2 November 14th 08 07:53 PM
return a number from a cell based on the lastest date sarahmarsden Excel Worksheet Functions 2 October 22nd 06 11:09 PM
Deleting rows based on number of characters catalfamo1220 Excel Discussion (Misc queries) 3 July 20th 06 06:31 PM
Split field based on number of characters and space william_mailer Excel Worksheet Functions 6 February 10th 06 01:26 AM
How to return # characters based on 2nd instance of value JDay01 Excel Worksheet Functions 4 May 19th 05 05:29 PM


All times are GMT +1. The time now is 12:23 AM.

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

About Us

"It's about Microsoft Excel"