ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Getting rid of a VALUE error (https://www.excelbanter.com/excel-discussion-misc-queries/201767-getting-rid-value-error.html)

Victor Delta[_2_]

Getting rid of a VALUE error
 
I have a formula in a spreadsheet with several nested if statements.

Even when some of the statements should be false, a #VALUE! error earlier on
is mucking up the logical outputs.

Is there a simple way to 'isolate' such an error code so that it does not
affect subsequent logical outputs please?

Thanks,

V


David Biddulph[_2_]

Getting rid of a VALUE error
 
ERROR.TYPE
http://office.microsoft.com/en-us/ex...090791033.aspx
--
David Biddulph

"Victor Delta" wrote in message
...
I have a formula in a spreadsheet with several nested if statements.

Even when some of the statements should be false, a #VALUE! error earlier
on is mucking up the logical outputs.

Is there a simple way to 'isolate' such an error code so that it does not
affect subsequent logical outputs please?

Thanks,

V




T. Valko

Getting rid of a VALUE error
 
Post the formula with an explanation of what you're trying to do.

--
Biff
Microsoft Excel MVP


"Victor Delta" wrote in message
...
I have a formula in a spreadsheet with several nested if statements.

Even when some of the statements should be false, a #VALUE! error earlier
on is mucking up the logical outputs.

Is there a simple way to 'isolate' such an error code so that it does not
affect subsequent logical outputs please?

Thanks,

V




Victor Delta[_2_]

Getting rid of a VALUE error
 
"T. Valko" wrote in message
...
Post the formula with an explanation of what you're trying to do.

Biff

Thanks. This illustrates the problem. One of the nested if statements is the
following

=IF(FIND("GRE",A22)=1,1,0) - testing, of course, whether the first three
letters of A22 are GRE

However, for many values of A22 (including blank), the output of the formula
is #VALUE! rather than 0. And this 'upsets' the rest of the logic whose
output also then comes to #VALUE!

Regards,

V


T. Valko

Getting rid of a VALUE error
 
=IF(FIND("GRE",A22)=1,1,0) - testing, of course, whether the first three
letters of A22 are GRE


Several ways to do this...

FIND is case sensitive so gre and GRE will not match. If no match is found
then you get the error. You can trap the error like this:

=IF(COUNT(FIND("GRE",A22)),1,0)

However, this seaches the entire string, not just the 1st 3 characters. If
you want to limit the search to just the 1st 3 characters:

=IF(LEFT(A22,3)="GRE",1,0)

However, this is not case sensitive. GRE will match gre. If you want to test
for the exact match of GRE then:

=IF(EXACT(LEFT(A22,3),"GRE"),1,0)


--
Biff
Microsoft Excel MVP


"Victor Delta" wrote in message
...
"T. Valko" wrote in message
...
Post the formula with an explanation of what you're trying to do.

Biff

Thanks. This illustrates the problem. One of the nested if statements is
the following

=IF(FIND("GRE",A22)=1,1,0) - testing, of course, whether the first three
letters of A22 are GRE

However, for many values of A22 (including blank), the output of the
formula is #VALUE! rather than 0. And this 'upsets' the rest of the logic
whose output also then comes to #VALUE!

Regards,

V




Victor Delta[_2_]

Getting rid of a VALUE error
 
"T. Valko" wrote in message
...
=IF(FIND("GRE",A22)=1,1,0) - testing, of course, whether the first three
letters of A22 are GRE


Several ways to do this...

FIND is case sensitive so gre and GRE will not match. If no match is found
then you get the error. You can trap the error like this:

=IF(COUNT(FIND("GRE",A22)),1,0)

However, this seaches the entire string, not just the 1st 3 characters. If
you want to limit the search to just the 1st 3 characters:

=IF(LEFT(A22,3)="GRE",1,0)

However, this is not case sensitive. GRE will match gre. If you want to
test for the exact match of GRE then:

=IF(EXACT(LEFT(A22,3),"GRE"),1,0)

Biff

Many thanks - that's brilliant!

V


T. Valko

Getting rid of a VALUE error
 
You're welcome. Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"Victor Delta" wrote in message
...
"T. Valko" wrote in message
...
=IF(FIND("GRE",A22)=1,1,0) - testing, of course, whether the first three
letters of A22 are GRE


Several ways to do this...

FIND is case sensitive so gre and GRE will not match. If no match is
found then you get the error. You can trap the error like this:

=IF(COUNT(FIND("GRE",A22)),1,0)

However, this seaches the entire string, not just the 1st 3 characters.
If you want to limit the search to just the 1st 3 characters:

=IF(LEFT(A22,3)="GRE",1,0)

However, this is not case sensitive. GRE will match gre. If you want to
test for the exact match of GRE then:

=IF(EXACT(LEFT(A22,3),"GRE"),1,0)

Biff

Many thanks - that's brilliant!

V





All times are GMT +1. The time now is 11:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com