Solved

Excel Formula Extended Help

Posted on 2013-11-15
23
282 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
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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

932 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

14 Experts available now in Live!

Get 1:1 Help Now