ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Enter one value, Return another (https://www.excelbanter.com/excel-discussion-misc-queries/21806-enter-one-value-return-another.html)

Sarah_Lecturer

Enter one value, Return another
 
Help!

I want to be able to enter a letter in say cell C2 and having pressed enter
return a figure...

A = 12
B = 10
C = 8
D = 6
E = 4
F = 2
U = 0

Any suggestions PLEASE?

Thanks

Sarah

Have it working on a Vlookup table but obviously cannot do this without
having two rows one for the answer and one for the formula - otherwise
circular reference returned!!

Thanks

Don Guillett

see later post

--
Don Guillett
SalesAid Software

"Sarah_Lecturer" wrote in message
...
Help!

I want to be able to enter a letter in say cell C2 and having pressed

enter
return a figure...

A = 12
B = 10
C = 8
D = 6
E = 4
F = 2
U = 0

Any suggestions PLEASE?

Thanks

Sarah

Have it working on a Vlookup table but obviously cannot do this without
having two rows one for the answer and one for the formula - otherwise
circular reference returned!!

Thanks




Gord Dibben

To do this in one cell would require VBA.

Here is some event code that will do the trick.

Option Compare Text
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Num As Long
Dim rng As Range
Set rng = Range("C2")
On Error GoTo endit
Application.EnableEvents = False

Select Case rng.Value
Case Is = "A": Num = 12
Case Is = "B": Num = 10
Case Is = "C": Num = 8
Case Is = "D": Num = 6
Case Is = "E": Num = 4
Case Is = "F": Num = 2
Case Is = "U": Num = 0
End Select
rng.Value = Num

endit:
Application.EnableEvents = True
End Sub

Right-click the sheet tab and "View Code". Copy/paste the above in that
module.


Gord Dibben Excel MVP

On Wed, 13 Apr 2005 08:03:17 -0700, "Sarah_Lecturer"
wrote:

Help!

I want to be able to enter a letter in say cell C2 and having pressed enter
return a figure...

A = 12
B = 10
C = 8
D = 6
E = 4
F = 2
U = 0

Any suggestions PLEASE?

Thanks

Sarah

Have it working on a Vlookup table but obviously cannot do this without
having two rows one for the answer and one for the formula - otherwise
circular reference returned!!

Thanks




All times are GMT +1. The time now is 03:04 PM.

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