Display specific text based on a value within the same cell??

realsongs

New Member
Joined
Dec 18, 2018
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Hi all,

Is it possbile to convert one text to another based on a set of values, all in the same cell???

For example, if I would like to type in an employees staff number is cell A1, and then for the text in cell A1 to display the corresponding staff members name.

I spent the past hour looking this up, and thought I came close with conditional formatting however the method I found doesn't seem to work.

Thank you in advance for looking!!!!

S
 

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
Excel 2010
ABCDEFGHI
1Emp#FnameLname
2100PeterSmith
3200PaulLong
4300MaryParker
5

<tbody>
</tbody>
Sheet1
Post the Code (below) into Sheet1 Module (as Event Code). This worked for me....
Type either 100, 200, or 300 into Cell A1 and Enter.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 1 Then Exit Sub
If Target.Value = "" Then Exit Sub
Application.ScreenUpdating = False
Application.EnableEvents = False
    OV = Target.Value
    Application.Undo
On Error Resume Next
Target.Value = WorksheetFunction.VLookup(OV, Range("$G$2:$I$4"), 2, False) & " " & WorksheetFunction.VLookup(OV, Range("$G$2:$I$4"), 3, False)
Application.ScreenUpdating = True
Application.EnableEvents = True
On Error GoTo 0
End Sub
 
Last edited:
Upvote 0
Many thanks for this, it worked perfectly.

I will modify the code to include a range of columns.

Thanks again!
 
Upvote 0
At Present you should be able to Fill multiple cells in Column A (A1,A2,A3,A4.....)
It close, but not perfect... Thanks for the response. Jim
 
Upvote 0

Forum statistics

Threads
1,215,071
Messages
6,122,964
Members
449,094
Latest member
Anshu121

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