Highlight if only one word?

jeffcoleky

Active Member
Joined
May 24, 2011
Messages
274
This is probably very simple but i cannot figure it out... I'm trying to highlight any word in Column B that only has numbers... Details below.

Excel 2010
ABC
AddressShort Address
123 Count St123 Count
555 Anony Mouse Ln555 Anony Mouse
222 Two St222 Two
123 Count<-- Need short addresses containing no street name to be highlighted
555 Anony Mouse555 Anony
222 Two

<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: right"][/TD]

[TD="align: center"]2[/TD]

[TD="align: right"][/TD]

[TD="align: center"]3[/TD]

[TD="align: right"][/TD]

[TD="align: center"]4[/TD]

[TD="align: right"][/TD]

[TD="align: center"]5[/TD]

[TD="bgcolor: #FFFF00, align: right"]123[/TD]

[TD="align: center"]6[/TD]

[TD="align: right"][/TD]

[TD="align: center"]7[/TD]

[TD="bgcolor: #FFFF00, align: right"]222[/TD]
[TD="align: right"][/TD]

</tbody>
Sheet1



Column A is raw data containing street addresses. Column B shows the same street address adjacent to it, but minus the last word. Here is the formula I use to generate column 2:

Code:
=PROPER(LEFT($A2,FIND("?",SUBSTITUTE($A2," ","?",LEN(TRIM($A2))-LEN(SUBSTITUTE($A2," ",""))-CHOOSE(--ISNUMBER(--RIGHT($A2,5))+1,0,1)))-1))

I need to create a conditional formatting rule that will highlight any cell in column B that does not contain a street name, or in other words, only contains numbers. You could also say any cell that does not include text. Or you could do any cell that only has one word in it.

I have tried ISNUMBER, ISTEXT and both don't work in my case because of the way i'm creating the value. The web showed me one formula to determine if the cell only contains one word, and that formula is: =LEN(TRIM(A2))-LEN(SUBSITUTE(A2," ",""))+1 However, that gives me a #NAME? error.

Can anyone please help me figure this out? It seems there should be a short answer to this that would work but I cannot figure it out :(
 
Use =isnumber(A1) in the conditional formatting

Here, it tests if the cell A1 is a number

Hope this works!
 
Upvote 0
=IF(ISERR(SEARCH(" ",(PROPER(LEFT($A2,FIND("?",SUBSTITUTE($A2," ","?",LEN(TRIM($A2))-LEN(SUBSTITUTE($A2," ",""))-CHOOSE(--ISNUMBER(--RIGHT($A2,5))+1,0,1)))-1))))),$A2,PROPER(LEFT($A2,FIND("?",SUBSTITUTE($A2," ","?",LEN(TRIM($A2))-LEN(SUBSTITUTE($A2," ",""))-CHOOSE(--ISNUMBER(--RIGHT($A2,5))+1,0,1)))-1)))

This makes sure you don't truncate two word cells in the first place
 
Upvote 0
=IF(ISERR(SEARCH(" ",(PROPER(LEFT($A2,FIND("?",SUBSTITUTE($A2," ","?",LEN(TRIM($A2))-LEN(SUBSTITUTE($A2," ",""))-CHOOSE(--ISNUMBER(--RIGHT($A2,5))+1,0,1)))-1))))),$A2,PROPER(LEFT($A2,FIND("?",SUBSTITUTE($A2," ","?",LEN(TRIM($A2))-LEN(SUBSTITUTE($A2," ",""))-CHOOSE(--ISNUMBER(--RIGHT($A2,5))+1,0,1)))-1)))

This makes sure you don't truncate two word cells in the first place

that's nice too :) thanks
 
Upvote 0
One the off chance Column B could contain as single word (original address had no number) or a number, you could use this Conditional Formatting formula...

=AND(B1<>"",LEN(B1)-LEN(SUBSTITUTE(B1," ",""))=0)
 
Upvote 0

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