PC Review


Reply
Thread Tools Rate Thread

Nested IF to evaluate street addresses

 
 
ManosS
Guest
Posts: n/a
 
      14th Mar 2006
I am not sure how to finish this nested if

I have 3 columns of data D1, E1, F1 e.g.
I want to check the first character only to see if it is a number.
However, the data is probably stored as text 123 MAIN ST

If the first character of D1 is not a number, then I want to check
first character of E1; if first character of E1 is not a number, then
check first char of F1.

Any ideas on this?

=IF(OR(D1, 1,1,2,3,4,5,6,7,8,9),"YES",IF(OR(E1,
1,1,2,3,4,5,6,7,8,9),"YES",IF(OR(F1, 1,1,2,3,4,5,6,7,8,9),"YES","NO")))

 
Reply With Quote
 
 
 
 
ManosS
Guest
Posts: n/a
 
      14th Mar 2006
Correction -- what I currently have is

=IF(OR(D1,1,2,3,4,5,6,7,8,9),"YES",IF(OR(E1,1,2,3,4,5,6,7,8,9),"YES",IF(OR(F1,1,2,3,4,5,6,7,8,9),"YES","NO")))

 
Reply With Quote
 
Bernard Liengme
Guest
Posts: n/a
 
      14th Mar 2006
Try this
=IF(AND(CODE(LEFT(D1))>=49,CODE(LEFT(D1))<=57),"yes",IF(AND(CODE(LEFT(E1))>=49,CODE(LEFT(E1))<=57),"yes",IF(AND(CODE(LEFT(F1))>=49,CODE(LEFT(F1))<=57),"yes","NO")))
If there is a chance that the entries in D1, E1, F1 could have leading
spaces, then replace D1 by TRIM(D1), etc.
Or
try this one
=IF(ISNUMBER(--LEFT(D6)),"yes",IF(ISNUMBER(--LEFT(E6)),"yes",IF(ISNUMBER(--LEFT(F6)),"yes","NO")))

the double negation converts text to number
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"ManosS" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I am not sure how to finish this nested if
>
> I have 3 columns of data D1, E1, F1 e.g.
> I want to check the first character only to see if it is a number.
> However, the data is probably stored as text 123 MAIN ST
>
> If the first character of D1 is not a number, then I want to check
> first character of E1; if first character of E1 is not a number, then
> check first char of F1.
>
> Any ideas on this?
>
> =IF(OR(D1, 1,1,2,3,4,5,6,7,8,9),"YES",IF(OR(E1,
> 1,1,2,3,4,5,6,7,8,9),"YES",IF(OR(F1, 1,1,2,3,4,5,6,7,8,9),"YES","NO")))
>



 
Reply With Quote
 
Ragdyer
Guest
Posts: n/a
 
      14th Mar 2006
Try this:

=IF(ISNUMBER(--LEFT(D1)),"formula for D1 is
number",IF(ISNUMBER(--LEFT(E1)),"formula for E1 is
number",IF(ISNUMBER(--LEFT(F1)),"formula for F1 is number","Formula for no
number anywhere")))
--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------

"ManosS" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I am not sure how to finish this nested if
>
> I have 3 columns of data D1, E1, F1 e.g.
> I want to check the first character only to see if it is a number.
> However, the data is probably stored as text 123 MAIN ST
>
> If the first character of D1 is not a number, then I want to check
> first character of E1; if first character of E1 is not a number, then
> check first char of F1.
>
> Any ideas on this?
>
> =IF(OR(D1, 1,1,2,3,4,5,6,7,8,9),"YES",IF(OR(E1,
> 1,1,2,3,4,5,6,7,8,9),"YES",IF(OR(F1, 1,1,2,3,4,5,6,7,8,9),"YES","NO")))
>


 
Reply With Quote
 
Harlan Grove
Guest
Posts: n/a
 
      14th Mar 2006
Bernard Liengme wrote...
>Try this
>=IF(AND(CODE(LEFT(D1))>=49,CODE(LEFT(D1))<=57),"yes",
>IF(AND(CODE(LEFT(E1))>=49,CODE(LEFT(E1))<=57),"yes",
>IF(AND(CODE(LEFT(F1))>=49,CODE(LEFT(F1))<=57),"yes","NO")))

....

You could shrink this to the following array formula.

=IF(COUNT(-LEFT(D1:F1)),"yes","no")

 
Reply With Quote
 
Bernard Liengme
Guest
Posts: n/a
 
      14th Mar 2006
True but I wanted a more flexible formula in case OP needed more than just
Yea or Nay
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Harlan Grove" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Bernard Liengme wrote...
>>Try this
>>=IF(AND(CODE(LEFT(D1))>=49,CODE(LEFT(D1))<=57),"yes",
>>IF(AND(CODE(LEFT(E1))>=49,CODE(LEFT(E1))<=57),"yes",
>>IF(AND(CODE(LEFT(F1))>=49,CODE(LEFT(F1))<=57),"yes","NO")))

> ...
>
> You could shrink this to the following array formula.
>
> =IF(COUNT(-LEFT(D1:F1)),"yes","no")
>



 
Reply With Quote
 
ManosS
Guest
Posts: n/a
 
      16th Mar 2006
Thank you both - this worked for me
=IF(ISNUMBER(--LEFT(D2,1)),"yes - address
1",IF(ISNUMBER(--LEFT(E2)),"yes - address
2",IF(ISNUMBER(--LEFT(F2)),"yes - address 3","no")))

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TRYING TO ALPHBETIZE STREET ADDRESSES =?Utf-8?B?QU5OQQ==?= Microsoft Excel Misc 1 26th Oct 2006 04:36 AM
Odd Street Addresses =?Utf-8?B?U3RldmUgSA==?= Microsoft Access Queries 1 26th Apr 2005 11:18 PM
Working with street addresses? =?Utf-8?B?U3VsbHk=?= Microsoft Excel Misc 1 16th Feb 2005 03:57 PM
Sorting Addresses in report by Street Name rather than by Street number. Frank Microsoft Access Form Coding 2 16th Apr 2004 05:23 PM
Sorting Street Addresses by Street Name =?Utf-8?B?U2NvdHQgaW4gRmxvcmlkYQ==?= Microsoft Excel Misc 4 18th Feb 2004 01:33 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:18 PM.