Home » excel » excel formula, detect building number in address

excel formula, detect building number in address

Posted by: admin May 14, 2020 Leave a comment


I have a column with addresses. I need a formula in excel to detect whether this data has a building number in the address line 1. Please see below sample data. I am trying to detect if this is a good address format or not in excel. This will help with my analysis. For example, H street below does not have a building number but 104 Washington Dr does have a building number. How can I build a formula to do this? Thanks!

enter image description here

How to&Answers:

Try this:

=IF(SUMPRODUCT(COUNTIF(A2;"*"&{"1";"2";"3";"4";"5";"6";"7";"8";"9";"0"} & "*"))>0;"Yes";"No")

enter image description here

This is how it works:

  1. COUNTIF(A2;"*"&{"1";"2";"3";"4";"5";"6";"7";"8";"9";"0"} & "*") will return an array of 0 and 1 if any number is present at any part of the string (we use wildcards * before and after)
  2. We sum up the array from step 1 with SUMPRODUCT.
  3. If the final sum is 0, it means NO, otherway means YES, because at least one number is present.


You could also use something like this:


This will return a boolean indicating that the string has numbers in it.

More explanation here