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
 
Both the value cell and formula cell are categorised as "general".

Do I need change this?
No, don't change it. On the company sheet:
Are your formula in I16 and below? If not where?
What results does the company sheet give for the sample data used in my post?
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hi,

The formula is in the column adjacent to the H-cell value (i.e. in Col I).
The formaula returns the following (I'd post a image of it but our system prevents this):

H - Col


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


I-Col


I16 = 1
I17 = 1
I18 = 1
I19 = 0
I20 = 1
I21 = 1

I'm after anything other than a dash (-) to be a one (1) and the dashes (-) to be zero's.
 
Upvote 0
dbrooks76

Can you confirm (that is post to the board again) the formulas you have in I16 (next to the dash) and I19 (next to the 0)?

In an empty cell put =LEN(H16) What result does it give?
 
Upvote 0
The formula is the same next to either the dash or the zero, which is:

=IF(H16="-",1,0)

Swapping the 1 or 0 (i.e., =IF(H16="-",0,1) simply reverses the result, it doesn't prevent the spreadsheet from reading a dash and zero as the same thing (on the company spreadsheet that is).
A blank spreadsheet shows, as you posted, the correct results - so they're must be some option selection wrong on this spreadsheet.

The =LEN(H16) formula returns one (1).

Very confusing!!
 
Upvote 0
The formula is the same next to either the dash or the zero, which is:

=IF(H16="-",1,0)
Well, the 1 and the 0 definitely should be the other way round if you want a "-" to return a 0. And I hope you really mean that cell I19 formula starts with =IF(H19 not =IF(H16

I can't figure what else could be causing the results you are getting on that company sheet. :(
 
Upvote 0
Sorry, yes that should have been H19.

I think I'll just produce a new spreadsheet - sounds much simpler.

Thanks for your help thought! Much appreciated!!! :biggrin:
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,519
Members
448,968
Latest member
Ajax40

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