Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# MS Excel - setting a column value based on another

Posted on 2013-10-29
Medium Priority
139 Views
I have an excel spreadsheet that has any columns, one of which column(T) is a role value.  I want column (U) to be a value based on the content of column T

example
T Contains Civilian then S = Civilian
T Contains SLED then S = S&L
T Contains Defense then S = Defense/Fedsec
T Contains Healthcare then S = Healthcare
T Contains CS then S = CS/Intel
0
Question by:Matt Pinkston
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 3
• 3

LVL 18

Expert Comment

ID: 39609381
Are these all of the values?  What format are they in originally (in column T)?  DO you have a sample workbook?
0

Author Comment

ID: 39609420
It is all general text... Yes that should probably do it for total.
0

LVL 23

Expert Comment

ID: 39609671
Maybe:

=LOOKUP(T2,{"Civilian","CS","Defense","Healthcare","Sled"},{"Civilian","CS/Intel","Defense/Fedsec","Healthcare","S&L"})

Note, the first array is in alphabetically ascending sorted order, the second array contains the corresponding strings to return.
0

Author Comment

ID: 39609998
did not work..

I tried I on a row that had ES XXXX CIVILIAN MANAGER in the lookup columns and it returned Defense/Fedsec
0

LVL 23

Expert Comment

ID: 39610014
In that case try:

=LOOKUP(9.9999E+307,SEARCH({"Civilian","CS","Defense","Healthcare","Sled"},T2),{"Civilian","CS/Intel","Defense/Fedsec","Healthcare","S&L"})
0

Author Comment

ID: 39647343
what is the 9.9999E+307,

=LOOKUP(9.9999E+307,SEARCH({"Civilian","CS","Defense","Healthcare","Sled"},T2),{"Civilian","CS/Intel","Defense/Fedsec","Healthcare","S&L"})
0

LVL 23

Accepted Solution

NBVC earned 2000 total points
ID: 39647712
It is the largest number that Excel recognizes.  The LOOKUP() is looking for that number in the results of the the SEARCH() function.  It obviously won't find it, so it returns the last number that is smaller than the lookup value, this representing the last time it found a match in the SEARCH() function.  And therefore returns the corresponding item from the last array.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calculâ€¦
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
###### Suggested Courses
Course of the Month4 days, 17 hours left to enroll