ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   how do I use only 2 characters in a field in a formula (https://www.excelbanter.com/excel-worksheet-functions/249770-how-do-i-use-only-2-characters-field-formula.html)

rgarner

how do I use only 2 characters in a field in a formula
 
A1 B1
MH*97*14*80 96

I want to us the first 2 characters in A1 in a formula to place a value in B1

If the 1st 2 characters in A1="MH" or "AP" then B1=96 else B1=90

How do I write that formula? (How do I use any of the characters, for
instance, if I want to use the 4th and 5th characters, 97)?

Thanks.

Gary''s Student

how do I use only 2 characters in a field in a formula
 
=IF(OR(LEFT(A1,2)={"AP","MH"}),96,90)

--
Gary''s Student - gsnu200909

Glenn

how do I use only 2 characters in a field in a formula
 
rgarner wrote:
A1 B1
MH*97*14*80 96

I want to us the first 2 characters in A1 in a formula to place a value in B1

If the 1st 2 characters in A1="MH" or "AP" then B1=96 else B1=90

How do I write that formula? (How do I use any of the characters, for
instance, if I want to use the 4th and 5th characters, 97)?

Thanks.



Look at IF(), LEFT(), MID() and OR() in the help file.

=IF(OR(LEFT(A1,2)="MH",LEFT(A1,2)="AP"),96,90)


All times are GMT +1. The time now is 01:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com