Solved

MS Excel - setting a column value based on another

Posted on 2013-10-29
7
136 Views
Last Modified: 2013-11-14
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
Comment
Question by:Matt Pinkston
  • 3
  • 3
7 Comments
 
LVL 18

Expert Comment

by:Steven Harris
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

by:Matt Pinkston
ID: 39609420
It is all general text... Yes that should probably do it for total.
0
 
LVL 23

Expert Comment

by:NBVC
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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:Matt Pinkston
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

by:NBVC
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

by:Matt Pinkston
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

by:
NBVC earned 500 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question