ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How can i tie a word to a number (https://www.excelbanter.com/excel-discussion-misc-queries/233701-how-can-i-tie-word-number.html)

eqcitizen

How can i tie a word to a number
 
How can i possibly tie a word to a number so that any time that word is
entered the number tied to it becomes the cell value.

Farhad

How can i tie a word to a number
 
I am not sure I underestand what do you mean but lets say you are looking for
the below:

A B C
1 aaa 15
2 bbb 32
3 ccc 45
4 ddd 26

if you want to tie the word "aaa" to the number 15 in cell C1 just put the
formula below in the cell C1:
=A1&B1
if this answers you please hit yes.

Thanks

--
Farhad Hodjat


"eqcitizen" wrote:

How can i possibly tie a word to a number so that any time that word is
entered the number tied to it becomes the cell value.


Gord Dibben

How can i tie a word to a number
 
You could have a helper cell with a formula.

=LOOKUP(A1,{"cat","dog","goat","horse","lion","oce lot";8,9,3,7,6,4})

Or to change the cell value that you typed into.

Option Compare Text
Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("A1:A10")
If Intersect(Target, r) Is Nothing Then
Exit Sub
End If
vals = Array("Cat", "Dog", "Goat", "Horse", "Lion", "Ocelot")
nums = Array(8, 9, 6, 3, 7, 4)
For Each rr In r
inum = 0
For i = LBound(vals) To UBound(vals)
If rr.Value = vals(i) Then
inum = nums(i)
End If
Next
If inum 0 Then
rr.Value = inum
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Fri, 12 Jun 2009 10:33:01 -0700, eqcitizen
wrote:

How can i possibly tie a word to a number so that any time that word is
entered the number tied to it becomes the cell value.




All times are GMT +1. The time now is 07:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com