Desmond Tatilian
Desmond Tatilian

Reputation: 61

Spreadsheet formula extract zip code from address

I have cells in column A that contain info as shown below, where the property address includes a zip code. This zip code can be one of seven different option, but always 5 digits.

I need a function that says:

IF the cell contains zipcode1, zipcode2, zipcode3, etc., then copy that zipcode to the next cell over.

Any help?

Dispatch Type: ********      

Service Fee Due :   ********  

Urgency      : ********       

Service Fee Paid:     ********

Net To Collect  :   ********

Dispatch ID  : ********

Dispatch Date: ********

Item 17822 : ********  

Customer: ********

Property Address: ********

Dispatch Contact(s):

Upvotes: 0

Views: 2296

Answers (1)

AdamL
AdamL

Reputation: 24619

As a first attempt, in cell B1:

=ArrayFormula(IF(REGEXMATCH(A:A,"(?i)zipcode"),IFERROR(REGEXEXTRACT(A:A,"[0-9]{5})),))

Upvotes: 3

Related Questions