How can I short cut a repetitive task in my spreadsheet.
When I enter Darwin, Nhulunbuy, or Katherine into Cell C Cell D should = Top End
When I enter Alice Springs or Tennant Creek into Cell C – Cell D Should = Central Australia
Kerry
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » If cell 1 contains a value make Cell 2 = a value
Kerryg,
This can be done with some code placed in the Worksheet_Change event subroutine of the sheet’s module. If you place any value in column C (C1 to C5000), the code will evaluate the input and place the correct value in the adjacent cell in column D.
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count > 1 Then Exit Sub If Not Intersect(Target, Range(“C1:C5000”)) Is Nothing Then Select Case Target Case “Darwin”, “Nhulunbuy”, “Katherine” Target.Offset(0, 1) = “Top End” Case “Alice Springs”, “Tennant Creek” Target.Offset(0, 1) = “Central Australia” End Select End If End Sub
Or you can enter the following formula in D1 and copy down
=IF(OR(C1=”Darwin”,C1=”Nhulunbuy”,C1=”Katherine”),”Top End”,IF(OR(C1=”Alice Springs”,C1=”Tennant Creek”),”Central Australia”,””))
HTH,
Maud
If your list is long or would be expanded in the future, I think creating a table of the location and region and then use a Vlookup formula to get the results from the table. I think it makes expanding and upkeep easier. Editing the table would not require changing any of the VLookup formulas.
Steve
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.
Notifications