# My First Post

#### quigley6

##### New Member
Hi, This is my first post.

I have a column in an Excel Sheet with the following cell information;

3.1.2.4
3.2.1.4.5
3.3.5.5
3.4.4.4
3.5.6.8.1
3.6.5.6.2.
3.7.2
3.7.3.1
3.7.6.2

I am trying to find the most efficient global formula to return the following results.

If 1st 2 characters equals 3.1 then return value "A"
If 1st 2 characters contains 3.2 then return value "B"
If 1st 2 characters contains 3.3 then return value "C"
If 1st 2 characters contains 3.4 then return value "D"
If 1st 2 characters contains 3.5 then return value "E"
If 1st 2 characters contains 3.6 then return value "F"
If 1st 2 characters contains 3.7 then return value "G"

Thank you all!

### Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

#### TheNoocH

##### Well-known Member
try something like this...just fill in the rest of the info...

=LOOKUP(LEFT(A1,3),{"3.1","A";"3.2","B"})
Book1
ABCD
13.1.2.4A
23.2.1.4.5B
33.3.5.5C
43.4.4.4D
53.5.6.8.1E
63.6.5.6.2.F
73.7.2G
83.7.3G
93.7.6.2G
Sheet1

#### barry houdini

##### MrExcel MVP
Does it go beyond G?

Try this in B1 copied down

=CHAR(LEFT(A1,3)*10+34)

#### quigley6

##### New Member
Wow! That worked. If I could ask a dumb question, can you break down the meaning of the following:

LEFT(A1,3)

Obviously "A1" is the cell number, but what does the LEFT and the value "3" mean. Thank you very much!!

try something like this...just fill in the rest of the info...

=LOOKUP(LEFT(A1,3),{"3.1","A";"3.2","B"})

[Edited by admin ~ removed quoted HTML example]

#### TheNoocH

##### Well-known Member

Wow! That worked. If I could ask a dumb question, can you break down the meaning of the following:

LEFT(A1,3)

Obviously "A1" is the cell number, but what does the LEFT and the value "3" mean. Thank you very much!!

sure...
left(A1,3) says take cell A1 and look at the left most 3 chars...
so if A1 = ABCDEFG

left(A1,3) = ABC

similarly

right (A1,3) = EFG

and

mid(A1,3,2) = CD where 3 is the position to start and 2 is the number of characters

hope that helps

#### quigley6

##### New Member
This is quite amazing.

One last question I did have was how to return something other than #N/A when no data is present.

Also, when there is data, but none of the conditions are met, is there a way to "flag" it with some unique name?

Worked Great!

Replies
3
Views
204
Replies
3
Views
452
Replies
11
Views
378
Replies
0
Views
87
Replies
4
Views
154

1,141,704
Messages
5,707,970
Members
421,538
Latest member
Krisco

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back