Search in cell

  • Thread starter Fredrik Jönsson
  • Start date
F

Fredrik Jönsson

Hi

I want to search in a cell. For example; if the cells value begins with 0701
cell C1 gets a value of 1. If the cell begins with 0702 cell c1 gets a
value of 2.

How do I make this funtion?

Thank

Fredrik
 
J

Jim

In the example you have given =Right(YourCell,1) would return the last digit
on the right.
 
D

Dave R.

Since you say "Begins with".. and there are 0s there, does that mean they
are text formatted cells? or numbers that show a 0 in front of them?


if they are text,

=+IF(LEFT(C1,4)="0701",1,IF(LEFT(C1,4)="0702",2))


if they are actually numbers, but are formatted to show a leading 0--
=+IF(LEFT(C1,3)="701",1,IF(LEFT(C1,3)="702",2))
 
D

Dave R.

whoops - You'll need to put a formula like below into C1 and change the cell
reference to wherever the 0701 numbers are.
 
F

Fredrik Jönsson

Thank you.... It solved my problem

Fredrik

Jim said:
In the example you have given =Right(YourCell,1) would return the last digit
on the right.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top