My First Post

quigley6

New Member
Joined
Oct 2, 2006
Messages
22
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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
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
 
Upvote 0
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]
 
Upvote 0
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
 
Upvote 0
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?
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,253
Members
448,556
Latest member
peterhess2002

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top