Put message in cell depending of characters in another cell

tmpollard

Board Regular
Joined
Jun 12, 2008
Messages
111
Hello all, I need help with a formula that will put a certain message in a cell depending on the first 4 digits of what is in another cell.
Example, cell A1 has 636755747857 the first 4 digits are 6367 so put "Blue" in cell B1.

There are about 20 combinations of the first 4 digits that will be unique so this is a shortened list. Thank You..

636755747857 Blue
636287561396 Yellow
636869685747 Green
636755747873 Blue
636287561324 Yellow
636869685740 Green
636755747865 Blue
636287561432 Yellow
636869685754 Green
636755747881 Blue
636287561360 Yellow
636869685733 Green
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Create a small table with the 4 digit codes and the colours, like (i put it in E1:F20)

Code:
[TABLE="width: 130"]
<!--StartFragment--> <colgroup><col width="65" span="2" style="width:65pt"> </colgroup><tbody>[TR]
  [TD="width: 65, align: right"]6367[/TD]
  [TD="width: 65"]Blue[/TD]
 [/TR]
 [TR]
  [TD="align: right"]6362[/TD]
  [TD]Yellow[/TD]
 [/TR]
 [TR]
  [TD="align: right"]6368[/TD]
  [TD]Green[/TD]
 [/TR]
<!--EndFragment--></tbody>[/TABLE]

Then use formula

=VLOOKUP(LEFT(A1,4)+0,$E$1:$F$20,2,FALSE)
 
Upvote 0

Forum statistics

Threads
1,215,055
Messages
6,122,902
Members
449,097
Latest member
dbomb1414

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