Chanoaguilas
New Member
- Joined
- Nov 19, 2018
- Messages
- 1
Hi guys,
I am new to using excel. so here's what I'm trying to do:
Some US zip codes have 9 digits and I want to a Hyphen "-" after the first 5 digits in a column. However, the same column also includes 5 digit ones so I am trying to use =IF(LEN(a2)>5,(REPLACE(a2,6,0,"-"))) but I can't seem to get it right. It should like this.
[TABLE="width: 152"]
<colgroup><col></colgroup><tbody>[TR]
[TD]21117-2111[/TD]
[/TR]
[TR]
[TD]21117[/TD]
[/TR]
[TR]
[TD]21234[/TD]
[/TR]
[TR]
[TD]20737-2073[/TD]
[/TR]
[TR]
[TD]21133-2113[/TD]
[/TR]
[TR]
[TD]21133-2113[/TD]
[/TR]
[TR]
[TD]20853[/TD]
[/TR]
[TR]
[TD]20850
[/TD]
[/TR]
</tbody>[/TABLE]
Can I have some help, please? Thank you.
I am new to using excel. so here's what I'm trying to do:
Some US zip codes have 9 digits and I want to a Hyphen "-" after the first 5 digits in a column. However, the same column also includes 5 digit ones so I am trying to use =IF(LEN(a2)>5,(REPLACE(a2,6,0,"-"))) but I can't seem to get it right. It should like this.
[TABLE="width: 152"]
<colgroup><col></colgroup><tbody>[TR]
[TD]21117-2111[/TD]
[/TR]
[TR]
[TD]21117[/TD]
[/TR]
[TR]
[TD]21234[/TD]
[/TR]
[TR]
[TD]20737-2073[/TD]
[/TR]
[TR]
[TD]21133-2113[/TD]
[/TR]
[TR]
[TD]21133-2113[/TD]
[/TR]
[TR]
[TD]20853[/TD]
[/TR]
[TR]
[TD]20850
[/TD]
[/TR]
</tbody>[/TABLE]
Can I have some help, please? Thank you.