View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
AltaEgo AltaEgo is offline
external usenet poster
 
Posts: 245
Default After checked condition, add the data to adjacent cell automatically

You may need to fiddle the numbers but, this should give you the idea:

=IF(LEN(D1)<10,5,IF(LEN(D1)<20,4,IF(LEN(D1)<30,3,I F(LEN(D1)<40,2,IF(LEN(D1)=40,1)))))

OK, that's a lot to take on board in one hit so let's go at it step-by-step:

The Syntax for If()

=IF(condition, If TRUE, If FALSE)

Add the condition:

=IF(LEN(D1)<10, If TRUE, If FALSE)


Now add the If TRUE part

=IF(LEN(D1)<10,5, If FALSE)

Now add the if FALSE part (which is another If() statement, until the last
nested IF when you use a value)

=IF(LEN(D1)<10,5, IF(condition, If TRUE, If FALSE))

Keep building replacing your condition, true and false parts until you cover
all conditions. There is a limit of seven nested Ifs.





--
Steve

"tlee" wrote in message
...
Hi all,

Could anyone help me how to check condition, and fill the data to the
adjacent cell automatically?

Such that, there are several columns at the worksheet.

And I specified to use 2 columns (C and D) only.

Column D contains characters in each cell.
Column C is blank Column without data in all cell.

It checks the number of the characters in each cell of column D.
If the number of characters is 10 in D2, then fill "5" into C2
If the number of characters is 20 in D3, then fill "4" into C3

How can I implement that operation?

Thanks for your in advance.

TLee