Put message in cell depending of characters in another cell

tmpollard

Board Regular
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

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

gaz_chops

Well-known Member
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)

Replies
4
Views
447
Replies
0
Views
474
Replies
3
Views
527
Replies
4
Views
255
Replies
7
Views
350

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,163,951
Messages
5,834,550
Members
430,295
Latest member
amdis

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.

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

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