Format column as Phone Number

DaveyD

New Member
Joined
May 20, 2015
Messages
31
Hi, I receive large reports in csv with connection data
I import that report into Power Query in order to create many transformations
I have a column that contains 10 digits as text, representing a phone number
I need to format that as a phone number as such: (123) 456-7890
I can't figure out how to use Text.Format to do this - I keep getting an error that it expects a record or list
I was trying:
each Text.Format(_, "(###) ###-####")

This formatting has to be done during PQ transformation - it cannot wait to be done after loaded

Why is this not working and how can I format as a phone number?

Thanks,
David
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
TelProper Format
2547890175(254) 789-0175
1234567890(123) 456-7890
0256900414(025) 690-0414


Rich (BB code):
Table.AddColumn(#"Changed Type", "Proper Format", each Text.Format("(#{0}) #{1}-#{2}", Splitter.SplitTextByLengths({3,3,4}) ([Tel]) ), type text)
 
Upvote 0
Wow, this is absolutely amazing!
I was so close with my attempts - I too tried using SplitTextByLength just as you did, but I didn't know how to apply it to Text.Format
It took me a couple of minutes to understand what the ([Tel]) was doing.
Splitter.SplitTextByLength is a function, therefore they get parens after it to accept an argument, which is [Tel]

Thanks so much!
 
Upvote 0

Forum statistics

Threads
1,223,793
Messages
6,174,635
Members
452,575
Latest member
Fstick546

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