Excel - Convert dates and currency as text to Excel dates and numbers respectively
Use the Text Import Wizard. You might have this option in the paste button that appears when you paste in your text. If not, it's in the Data tab of the ribbon. Click Text to Columns. When you get to step 3, import column A as Date: MDY. Then you shouldn't have to use the VALUE
function for your dates.
Related videos on Youtube
Khalid
I'm Dai, I'm currently a software engineer in Seattle doing the rounds on a variety of startups. I'm mostly familiar with the .NET stack. (Just don't call me a "full-stack" engineer - there's more to software than a "back-end" vs. "front-end" dichotomy: think about embedded and robotics, industrial control, avionics, systems programming with Rust, and so on!) Prior to the startup scene I was gainfully employed at Microsoft as a Software Engineer for the Chakra JavaScript engine (Edge and Internet Explorer), prior to that I worked on Expression Blend and Visual Studio. I like to think I have extensive experience in C# and the .NET Framework, and modest experience in C++. Prior to Microsoft I worked on web-applications and web-services using ASP.NET Web Forms, ASP.NET MVC, and WCF. I also have experience in PHP, Java and other non-Microsoft platforms and technologies for which I'm happy to answer questions about. Also: Everything is terrible. Life is short and love is always over in the morning.
Updated on September 18, 2022Comments
-
Khalid over 1 year
I frequently copy and paste HTML tables into Excel to do quick aggregate operations (e.g. sums, averages, etc).
In this example, PayPal, their HTML table contains text values like
A | B | C 1 | Date | Type | Net 2 | 5/14/2013 | Payment | $4.70 USD
I want to get the actual Date and Currency values from this table into a format that Excel understands (note that my computer is set to "English (United Kingdom)" and I custom-set my Windows Short Date format to
yyyy-MM-dd
) and my default Excel currency is £ GBP.I create a new column in Excel,
D
, and set the cells to=VALUE( A2 )
and a Currency columnE
set to=VALUE( C2 )
.However for both columns, D and E, Excel gives me the
#VALUE!
error (because it won't parseMM/dd/yyyy
as a date as it expectsyyyy-MM-dd
, nor$x.xx USD
as it expects£x.xx
- so I need to get it to ignore both the initial currency symbol and the trailing 3-character nameUSD
)I don't want to have to write an ugly string-parsing function in VBA (or worse, Excel formula syntax) to convert
"$4.70 USD"
into4.7
or"5/14/2013"
into2013-05-14
, but is there any other way? -
Khalid over 8 yearsThat works for dates, but what about the currency values?
-
benshepherd over 8 yearsIn that case, the formula
=VALUE(LEFT(C2,FIND(" ",C2)))
should chop the trailing "USD" off and convert the text to a number.