Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need MS excel IF formula

Status
Not open for further replies.

capronton

MIS
Jun 28, 2013
159
US
IF textString is 4 characters then i want first two characters, else first character.

Example below:

505 5
1305 13

I'm working with the formula below. Can someone tell me what is wrong with this formula? I know this is not an excel formula, but thought I would ask.

=IF (LEN(A1,4),LEFT(C2388,2,LEFT(C2388,1))

Thanks.
 
Formula should be:

=IF (LEN(A1,4),(LEFT(A1,2),(LEFT(A1,1))
 
If len({textString}) = 4 then left({textString},2) else left({textString},1)
 
The Excel formula is


=IF (LEN(A1)=4,LEFT(A1,2),LEFT(A1,1))

assuming your value is in A1.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top