Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to have two cells with one cell depending on the other value. Ex. If
A1=Raja then A2 should display 11, else if A1=Chirala, then A2 should display 12. Please give information on this if this type of programming is possible in excel. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In A2, =if(a1="Raja",11,if(a1="Chirala",12,""))
A2 will display blank if neither condition is met. Raja Suman wrote: I want to have two cells with one cell depending on the other value. Ex. If A1=Raja then A2 should display 11, else if A1=Chirala, then A2 should display 12. Please give information on this if this type of programming is possible in excel. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
you could use select case
Sub test() Dim nm As String nm = Range("A1").Value Select Case nm Case "raja" Range("a2").Value = 11 Case "Chirala" Range("A2").Value = 12 Case Else Range("a2").Value = "" End Select End Sub -- Gary "Raja Suman" <Raja wrote in message ... I want to have two cells with one cell depending on the other value. Ex. If A1=Raja then A2 should display 11, else if A1=Chirala, then A2 should display 12. Please give information on this if this type of programming is possible in excel. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here is the If ...Then...ElseIf code:
Sub RajChi() If Range("$A$1").Value = "Raja" Then Range("$A$2").Value = "11" ElseIf Range("$A$1").Value = "Chirala" Then Range("$A$2").Value = "12" End If End Sub This works on a pass basis. That is, if a name is in the cell when the code runs you will get the appropriate number. However, if you change the name and don't run the code again, the number does not change. "Raja Suman" wrote: I want to have two cells with one cell depending on the other value. Ex. If A1=Raja then A2 should display 11, else if A1=Chirala, then A2 should display 12. Please give information on this if this type of programming is possible in excel. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Implement Hyperlink in Excel Worksheet using c# | Excel Worksheet Functions | |||
Implement object persistence inside Excel | Excel Discussion (Misc queries) | |||
WNetGetUniversalName - how to implement in VBA? | Excel Programming | |||
How would I implement this cell increment? | Excel Discussion (Misc queries) | |||
How do I,implement a recurssive loop using Microsoft Excel ? | Excel Programming |