LEFT, MID, and RIGHT = text and/or number

OutCold

New Member
Joined
Feb 14, 2014
Messages
5
Hello, first time user, first post

I have a 2 page workbook where sheet2 is a large chart which gives different definitions for myriad alphanumeric codes. My goal is to give a user of this workbook the ability to enter a 6 digit, alphanumeric code into one cell on sheet1. In 6 separate cells on sheet1 I'm using the LEFT, MID, and RIGHT functions to pull each digit from that code. Each digit has the potential of being a number or text. Also, each of the six digits have a different definition. In a 7th cell on sheet1 is where I have my vlookups pulling info from sheet2.

My workbook works perfectly when only using the 6 cells to enter data. It's only when I use the left, mid and right functions that I get the error "#N/A". Furthermore, it only gives the error when the digit to be shown is a number, obviously because it's formatted as text. The problem is, sometimes it WILL be text.

A1 will have 6 digit alphanumeric code
A2 will show value of digit 1 only.
A3 will show value of digit 2 only. etc...

How can I format my cells, that will inevitably have a Number value, to automatically format themselves for numbers or text?

Thanks,
Rich
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hello, first time user, first post

I have a 2 page workbook where sheet2 is a large chart which gives different definitions for myriad alphanumeric codes. My goal is to give a user of this workbook the ability to enter a 6 digit, alphanumeric code into one cell on sheet1. In 6 separate cells on sheet1 I'm using the LEFT, MID, and RIGHT functions to pull each digit from that code. Each digit has the potential of being a number or text. Also, each of the six digits have a different definition. In a 7th cell on sheet1 is where I have my vlookups pulling info from sheet2.

My workbook works perfectly when only using the 6 cells to enter data. It's only when I use the left, mid and right functions that I get the error "#N/A". Furthermore, it only gives the error when the digit to be shown is a number, obviously because it's formatted as text. The problem is, sometimes it WILL be text.

A1 will have 6 digit alphanumeric code
A2 will show value of digit 1 only.
A3 will show value of digit 2 only. etc...

How can I format my cells, that will inevitably have a Number value, to automatically format themselves for numbers or text?

Thanks,
Rich

Maybe something like this



A

1

AN24G7​

2

A​

3

N​

4

2​

5

4​

6

G​

7

7​

<TBODY>
</TBODY>



Formula in A2 copied down
=IFERROR(0+MID($A$1,ROWS(A$2:A2),1),MID($A$1,ROWS(A$2:A2),1))

Hope this helps

M.
 
Upvote 0
You'll need to use =value(

so something like =value(left(A1,1))

That will return the number as a number. To account for times when it is supposed to be text, use something like =iferror(

So =iferror(value(left(A1,1)),left(A1,1)) will return the first character or A1 as a number when it's a number and as text when it's not.
 
Upvote 0
you'll need to use =value(

so something like =value(left(a1,1))

that will return the number as a number. To account for times when it is supposed to be text, use something like =iferror(

so =iferror(value(left(a1,1)),left(a1,1)) will return the first character or a1 as a number when it's a number and as text when it's not.

this worked perfectly!!!! Thanks!!!!!
 
Upvote 0

Forum statistics

Threads
1,215,352
Messages
6,124,449
Members
449,160
Latest member
nikijon

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