Formula Problem

dbrooks76

New Member
Joined
Sep 26, 2006
Messages
9
Hi,

I'm trying to get a spreadsheet to read a formula that will return a dash (-) as a zero (0) whilst any other number, including zero (0), is to be returned as a one (1).

My current formula reads a dash and zero both as zero's and so returns the wrong answer.

=IF(H16="-",1,0)
if true = 1
if false = 0

Any idea's how I can prevent this?

Cheers,

Dave
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
dbrooks76

Welcome to the Mr Excel board!

I may not have understood correctly, but I think you just need to swap the 0 and 1 in your formula. Try this:
=IF(H16="-",0,1)

If this is not it please give a few examples of data and expected results.
 
Upvote 0
Tried That!

Hi,
thanks for quick reply. But I've tried that and it throws the zero figures back as a zero.
I'm after any number to be returned as a one (1) and any dashes (-) to be zero.

So if:
H16 = -
H17 = 2.0
H18 = 2.3
H19 = 0
H20 = 1.2
H21 = -

The answers should be:
H16 = 0
H17 = 1
H18 = 1
H19 = 1
H20 = 1
H21 = 0

???
 
Upvote 0
dbrooks76

Your last post lists the answers in the same cells as the original data. I assume that was a mistake and the results are to be in an adjacent cell. If not post back.

Here is my sheet with the formula in I16 (copied down): =IF(H16="-",0,1)
Mr Excel.xls
GHIJ
15
16-0
1721
182.31
1901
201.21
21-0
22
Sheet1
 
Upvote 0
The dash is where no value is known. and the zero's are actual values (where present).

Strangely just tried the formula on a new spreadsheet and it works, but the company spreadsheet doesn't!! Weird!! I think i'm stepping into bigger problems...!!!

Thanks for all your help though guys!
 
Upvote 0
Strangely just tried the formula on a new spreadsheet and it works, but the company spreadsheet doesn't!! Weird!!
On the company spreadsheet, select H16 and then go Format|Cells...|Number What category is the cell formatted as?
Do the same on cell I16 (or wherever the formula is located).
 
Upvote 0

Forum statistics

Threads
1,214,431
Messages
6,119,458
Members
448,899
Latest member
maplemeadows

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