Solved

Excel Formula Extended Help

Posted on 2013-11-15
23
304 Views
Last Modified: 2013-11-15
I need to add additional logic to an existing formula and need help...

My current formula is:
=LOOKUP(9.9999E+307,SEARCH({"Civilian","CONSULT","Defense","Navy","Healthcare","Sled"},I3),{"Civilian","USPS Intel","Defense/Fedsec","Navy/Marine Corp","Healthcare","S&L"})

Which checks in the current column I and if certain values exist then the formula column is set to a specific value.

I also need to add logic that looks if column B begins with "CS-" or "CS -" and then sets the formula column to Federal CS
0
Comment
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
  • Learn & ask questions
  • 10
  • 9
  • 4
23 Comments
 
LVL 23

Expert Comment

by:NBVC
ID: 39651630
Do you mean?

=IF(OR(B3="CS-",B3="CS -"),"Federal CS",LOOKUP(9.9999E+307,SEARCH({"Civilian","CONSULT","Defense","Navy","Healthcare","Sled"},I3),{"Civilian","USPS Intel","Defense/Fedsec","Navy/Marine Corp","Healthcare","S&L"}))
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 39651641
You could add an IF function to do that, i.e.

=IF(SUM(COUNTIF(B3,{"CS-*","CS -*"})),"Federal CS",LOOKUP(9.9999E+307,SEARCH({"Civilian","CONSULT","Defense","Navy","Healthcare","Sled"},I3),{"Civilian","USPS Intel","Defense/Fedsec","Navy/Marine Corp","Healthcare","S&L"}))

regards, barry
0
 
LVL 23

Expert Comment

by:NBVC
ID: 39651649
Shoot... I forgot that you were looking for "begins with".

Here is my udated formula....

=IF(OR(LEFT(B3,3)="CS-",LEFT(B3,4)="CS -"),"Federal CS",LOOKUP(9.9999E+307,SEARCH({"Civilian","CONSULT","Defense","Navy","Healthcare","Sled"},I3),{"Civilian","USPS Intel","Defense/Fedsec","Navy/Marine Corp","Healthcare","S&L"}))
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Matt Pinkston
ID: 39651651
I think it would need to be reversed or it would never = Federal CS??
0
 
LVL 23

Expert Comment

by:NBVC
ID: 39651662
The formula as we wrote them, checks if B3 begins with your states strings.... If it does then you will get "Federal CS", otherwise, it will continue on with the lookup in I3...

Is that not what you wanted?
0
 

Author Comment

by:Matt Pinkston
ID: 39651668
yes so it could meat both criteria and I would never get Federal CS

It needs to check I3 first then B3
0
 
LVL 23

Expert Comment

by:NBVC
ID: 39651671
so, I you want it to check B3 if the I3 check returns an error?

Like:
=IFERROR(LOOKUP(9.9999E+307,SEARCH({"Civilian","CONSULT","Defense","Navy","Healthcare","Sled"},I3),{"Civilian","USPS Intel","Defense/Fedsec","Navy/Marine Corp","Healthcare","S&L"}),IF(OR(LEFT(B3,3)="CS-",LEFT(B3,4)="CS -"),"Federal CS",""))
0
 

Author Comment

by:Matt Pinkston
ID: 39651732
No

From my first post

=LOOKUP(9.9999E+307,SEARCH({"Civilian","CONSULT","Defense","Navy","Healthcare","Sled"},I3),{"Civilian","USPS Intel","Defense/Fedsec","Navy/Marine Corp","Healthcare","S&L"})

This gives me what I am looking for EXCEPT

After this, when B begins with "CS-" or "CS -" I need to set the column to Federal CS

With the solutions provided it is ALWAYS USPS Intel because when B begins with CS- or CS - it will also always have CONSULT in I3
0
 

Author Comment

by:Matt Pinkston
ID: 39651798
was thinking of something like this but does not work

=IF(LOOKUP(9.9999E+307,SEARCH({"Civilian","CONSULT","Defense","Navy","Healthcare","Sled"},I3),{"Civilian","USPS Intel","Defense/Fedsec","Navy/Marine Corp","Healthcare","S&L"}),(LEFT(B3,3)="CS-",LEFT(B3,4)="CS -"),"Federal CS")
0
 
LVL 23

Expert Comment

by:NBVC
ID: 39651845
I am getting lost here.

Can you give examples of possible combinations of what's in B3 and I3 and what you expect as results?
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 39651849
Can you give an example where the the formula I suggested doesn't do what you want? From your description I don't see why you wouldn't check B3 first - in what circumstances would B3 start with CS- or CS - and the result needs to be something other than Federal CS?
0
 

Author Comment

by:Matt Pinkston
ID: 39651870
Okay in this example

Column B = CS - NSS - Option Yr 3
Column I = ES USPS CONSULTING SERVICES AND INTEL MANAGER

Result is = USPS Intel

Result should be Federal CS
0
 
LVL 23

Expert Comment

by:NBVC
ID: 39651892
But that is what my original formula should do:

=IF(OR(LEFT(B3,3)="CS-",LEFT(B3,4)="CS -"),"Federal CS",LOOKUP(9.9999E+307,SEARCH({"Civilian","CONSULT","Defense","Navy","Healthcare","Sled"},I3),{"Civilian","USPS Intel","Defense/Fedsec","Navy/Marine Corp","Healthcare","S&L"}))

In that sample, you would get "Federal CS"

If B3 was say just: NSS - Option Yr 3, then the formula result would be USPS Intel...
0
 

Author Comment

by:Matt Pinkston
ID: 39651905
if I use this formula

=IF(OR(LEFT(B3,3)="CS-",LEFT(B3,4)="CS -"),"Federal CS",LOOKUP(9.9999E+307,SEARCH({"Civilian","CONSULT","Defense","Navy","Healthcare","Sled"},I3),{"Civilian","USPS Intel","Defense/Fedsec","Navy/Marine Corp","Healthcare","S&L"}))

all fields now = #N/A
0
 
LVL 23

Expert Comment

by:NBVC
ID: 39651912
Are you able to attach your file?  You can delete or change irrelevant columns if they are confidential.
0
 

Author Comment

by:Matt Pinkston
ID: 39651923
sample data
sampledata.xlsx
0
 

Author Comment

by:Matt Pinkston
ID: 39651928
in that example J3-5,7&8 should be Federal Consulting
J6,9&10 should be USPS Intel
0
 
LVL 23

Accepted Solution

by:
NBVC earned 500 total points
ID: 39651934
I just plugged my formula into J3 and copied down... I got expected results.  Ie the first 3, the 5th and 6th result in "Federal CS", the others result in "USPS Intel"

Exactly as you just stated
Copy-of-sampledata.xlsx
0
 

Author Comment

by:Matt Pinkston
ID: 39651946
okay now it is working, what changed?
0
 
LVL 23

Expert Comment

by:NBVC
ID: 39651953
Nothing at all.  I used the formula I recommended in post ID: 39651649 above.  And you repasted 6 posts up from here...
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 39652013
...and wasn't the formula I posted the first working solution?

regards, barry
0
 
LVL 23

Expert Comment

by:NBVC
ID: 39652032
Technically it was... but I did acknowledge that I neglected the "begins with" part and corrected my formula to suit.  I did follow through and stick with the OP so that he/she can finally understand that the solution(s) were correct to start.... but if you want the points, by all means, OP please transfer the points as you see fit...
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 39652073
Hey, NB_VC!

My comment was more directed at pinkstonmp.......but it's over now, C'est la vie, as they say in Canada.

Points, you say, do you get points here, I never knew that?......:)

regards, barry
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

749 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