Solved

# excel fomula

Posted on 2013-05-16
238 Views
I need help to write the formular for ship type column.
The excel file has two columns, if the column shipper value doesn't begin with 'C-', or ' F-' or 'S-', then ship type column should be unknown, otherwise will return the first letter of Shipper column.

SHIPPER      SHIP TYPE
PAT                 unknown
C-TH                 C
F-KC                 F
S-DB                 S
........
.......

thanks,
0
Question by:HemlockPrinters
[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
• 6
• 4
• 2
• +1

LVL 81

Expert Comment

ID: 39172429
Assuming the Shipper is in column A:

=IF(OR(LEFT(A2,2)="C-",LEFT(A2,2)="F-"LEFT(A2,2)="S-"),LEFT(A2,1),"unknown")

Kevin
0

LVL 23

Assisted Solution

NBVC earned 200 total points
ID: 39172433
Assuming data starts in A2, try:

=IF(OR(ISNUMBER(SEARCH({"C-","F-","S-"},A2))),LEFT(A2),"unknown")

copied down
0

LVL 81

Assisted Solution

zorvek (Kevin Jones) earned 200 total points
ID: 39172440
More compact:

=IF(OR(LEFT(A2,2)={"C-","F-","S-"}),LEFT(A2,1),"unknown")

Kevin
0

LVL 43

Assisted Solution

Saqib Husain, Syed earned 100 total points
ID: 39172445
=IF(ISERR(FIND(LEFT(A1,2),"C-F-S-")),"unknown",LEFT(A1))
0

LVL 23

Assisted Solution

NBVC earned 200 total points
ID: 39172453
or still more compact:

=IF(OR(LEFT(A2,2)={"C-","F-","S-"}),LEFT(A2),"unknown")
0

LVL 92

Expert Comment

ID: 39172484
"Name that tune!"
0

LVL 81

Expert Comment

ID: 39172488
Go play with Access. We're busy here.
0

LVL 43

Expert Comment

ID: 39172494
0

LVL 81

Accepted Solution

zorvek (Kevin Jones) earned 200 total points
ID: 39172498
A more generic solution that looks for any value with a letter followed by a dash followed by two letters:

=IF(ISERR((SEARCH("?-??",A2))),"unknown",LEFT(A2))

Kevin
0

LVL 23

Expert Comment

ID: 39172546
Hey Kevin, just bought your book with Jelen/Umlas, to give to my sister in-law... hopefully it'll get her off my back for a while ;)
0

LVL 81

Expert Comment

ID: 39172552
:-)
0

LVL 81

Expert Comment

ID: 39172556
Not Umlas, Urtis.
0

LVL 23

Expert Comment

ID: 39172569
ooops...   :)
0

## Featured Post

Question has a verified solution.

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

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference texâ€¦
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will diâ€¦
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 will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
###### Suggested Courses
Course of the Month2 days, 23 hours left to enroll