If statement help

CROY1985

Well-known Member
Joined
Sep 21, 2009
Messages
501
Office Version
  1. 365
Platform
  1. Windows
I need an If statement that will be placed in column A. It will look at column B (a range of account numbers) and then name them accordingly.
Those account numbers falling between 100000 and 199999 inclusive need to be named "Sales". 200000 and 399999 need to be named "Direct Costs". anything else named "overheads".

The formula i am using keeps returning the false value no matter which number is in column b, and therefore all cells are being named overheads.

Here is what i have at the moment.

Code:
=IF(AND(B14>=100000,B14<=199999),"Sales",IF(AND(B14>=200000,B14<=399999),"Direct Costs", "Overheads"))

Can anyone correct my formula?

Thanks
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
The formula looks allright. What is the formatting of the cells in column B? Is it General, or rather Text?
 
Upvote 0
You could always use this instead...


Code:
=IFERROR(LOOKUP(B14,{100000,200000,400000},{"Sales","Direct Costs","Overheads"}),"Overheads")

:)
 
Upvote 0
just tested it in a blank spreadsheet and it works.

Column B is part of an ms query table - so that must be the problem. Even though i have selected column b and formatted cells as number, it still has no bearing on the outcome of the if statement.

Any ideas on how i can work around this?
 
Upvote 0
Some further info, if i cut and paste numbers from column b to a blank column i get the warning saying the numbers are stored as text. IS there another way of converting them - other than format cells, number?
 
Upvote 0
Copy an empty cell, select column B cells, "paste special" and choose "Add".
 
Upvote 0

Forum statistics

Threads
1,224,560
Messages
6,179,520
Members
452,921
Latest member
BBQKING

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