IF? formula to change cell if it contains one of several options

GaryCee

New Member
Joined
Mar 20, 2017
Messages
5
Hello, thanks for any help you might be able to give me. My knowledge of formulas is limited so apologies if I'm not very clear.

Our supplier is split into 4 divisions, with each division having multiple short codes for each branch - see below for an example (there can be 30+ short codes for each division but I have just given a small example).

Pipe
Drain
Plumb
Climate
BPQHBATG52
BMQDLBGBTHM
BSP12BGE
BYHGHBH
K13FLBRT
K16FJBXD
K66CH
K68CT
K83

<tbody>
</tbody>

I have the statement in an excel spreadsheet downloaded from the supplier website so I can keep a tally of all the invoices that come in. The statement only shows the Branch Short Codes (C) but I would like to create a formula so it also shows the Division in column F....

A
B
C
D
E
F
1
Invoice
Date
Branch
Amount
Type
Division
2
118/03/2017BP£1.00InvoicePipe
3
218/03/2017QH£1.00InvoiceDrain
4
320/03/2017BXD£1.00InvoicePlumb
5421/03/2017BY£1.00InvoicePipe
6521/03/2017CT£1.00InvoicePlumb

<tbody>
</tbody>

I have tried using an IF formula in Column F but have just tried to add another branch sort code to it, and it tells me the formula is now too long - this is a much shortened version of what I have been using =IF($C$2:$C$999="BS","Pipe",IF($C$2:$C$999="QH","Drain",IF($C$2:$C$999="BRT","Plumb")))

Any help is much appreciated.

Thanks
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
You can do this by creating a "Master" table of Divisions and Branches. Simply create 2 headings, Division and Branch, then add the names of the divisions under the Division heading, and the names of their respective branches under the Branch heading.

This is how you should store data in Excel so that it will allow you to lookup a Division if you have a Branch.

If you enter Branches in column A and Divisions in column B (in a sheet called Master), you can use the following formula in cell F2 (and onwards) to lookup the Division from a Branch:
=VLOOKUP(C2,Master!$A:$B,2,false)

See this page for more information about the VLOOKUP formula. https://support.office.com/en-us/article/VLOOKUP-function-0bbc8083-26fe-4963-8ab8-93a18ad188a1
 
Upvote 0

Forum statistics

Threads
1,214,921
Messages
6,122,280
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top