Solved

Excel Formula Extended Help

Posted on 2013-11-15
23
270 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
  • 10
  • 9
  • 4
23 Comments
 
LVL 23

Expert Comment

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

Author Comment

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

Expert Comment

by:NBVC
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:Matt Pinkston
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Are you able to attach your file?  You can delete or change irrelevant columns if they are confidential.
0
 

Author Comment

by:Matt Pinkston
Comment Utility
sample data
sampledata.xlsx
0
 

Author Comment

by:Matt Pinkston
Comment Utility
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
Comment Utility
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
Comment Utility
okay now it is working, what changed?
0
 
LVL 23

Expert Comment

by:NBVC
Comment Utility
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
Comment Utility
...and wasn't the formula I posted the first working solution?

regards, barry
0
 
LVL 23

Expert Comment

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
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 Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now