set default answer when zipcode extract is not a number

MrsFixIt

New Member
Joined
Apr 15, 2016
Messages
18
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
my issue is getting the default zip code of 99999 answers when the extracted is not a number. I tried isnumber, but it kept rejecting with too many arguments message
question01.PNG
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
You do not need to explicitly check for <>"SAME" in your logic. If you reach that part of the IF, you already know it is not "SAME". You had the right idea with ISNUMBER but you have to first convert the string to a value.

Try this
Excel Formula:
=IF([@ALTAddress]="SAME",[@Zip],IF(ISNUMBER(VALUE(RIGHT([@ALTAddress],5))),RIGHT([@ALTAddress],5),99999))
 
Upvote 0
Another option
Excel Formula:
=IF([@ALTAddress]="SAME",[@Zip],IFERROR(RIGHT([@ALTAddress],5)+0,99999))

BTW, I suggest that you investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with. ;)

You should also update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

1605239290128.png
 
Upvote 0
You do not need to explicitly check for <>"SAME" in your logic. If you reach that part of the IF, you already know it is not "SAME". You had the right idea with ISNUMBER but you have to first convert the string to a value.

Try this
Excel Formula:
=IF([@ALTAddress]="SAME",[@Zip],IF(ISNUMBER(VALUE(RIGHT([@ALTAddress],5))),RIGHT([@ALTAddress],5),99999))
this is cool and I will give it a try.
 
Upvote 0
Another option
Excel Formula:
=IF([@ALTAddress]="SAME",[@Zip],IFERROR(RIGHT([@ALTAddress],5)+0,99999))

BTW, I suggest that you investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with. ;)

You should also update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

View attachment 25995
this is neat and I will also try this. thanks for the recommendations. what does CODE represent?
 
Upvote 0
what does CODE represent?
CODE is a tag used around formulas to format it to make it more readable and color-code different elements. You can do this by selecting your formula then clicking the "fx XLS" button in the edit controls.
 
Upvote 0
@6StringJazzer
While on codes & edit buttons, I notice that your signature includes a button whose image is now different. You may want to update your signature?
 
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,191
Members
453,021
Latest member
pingpong7117

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