Comparing the first x numbers in a cell

Closed
nephetius - May 14, 2009 at 09:22 PM
mubashir aziz Posts 190 Registration date Sunday April 12, 2009 Status Member Last seen February 16, 2010 - May 19, 2009 at 03:00 AM
Hello, I am trying to get a formula to read a 9 to 10 digit number in a cell to determine where to apply the formula results.

ie... the first 3 digits of a 9 to 10 digit code specifies which dept to appply the data that follows in that row

like this..... 125xxxxxxx would be matched to shipping 3expenses, 164xxxxxxx would be for office supplies and so on..

I want to check the first 3 numbers only as they are the "important ones in this particular case.....?

please help if you can

Thanks!

1 response

mubashir aziz Posts 190 Registration date Sunday April 12, 2009 Status Member Last seen February 16, 2010 166
May 19, 2009 at 03:00 AM
Here is the solution ....... you can enter your calculations there ....... suppose your code is in Cell A1 then by using this formula in B1 or C1 you can pick up first 3 char and then can do your calculations ...

=IF(LEFT(A1,3)="125","Do the calculation",IF(LEFT(A1,3)="164","do the office calculation"))


0