Hafiz, One of our avid readers, writes in.
Dear chandoo,
all the time, I use to spend time exploring chandoo.org. it’s very helpful site. thanks for your day & night efforts.
here I have to face a problem with “Text to Column”. can you please spare some time & guide me.
The problem is when I convert data from text to column using dash “-“, conversion is easy. but when the gap provided in text is with “alt+enter”, i can’t convert the data.
Do you have some solution specifically using text to column.
Well, I tried to use text to columns feature (from Data ribbon) and it would not work.
Although you can use formulas to do the splitting, they might become tedious. So the next logical option is to use macros.
Excel Macros to Split Text on New Lines
So I wrote a simple macro, that would take the text in current cell, split it and place it in adjacent cells. Like this:

Macro Code to split text on new line:
Here is the macro code to split text based on new lines.
Sub splitText()
'splits Text active cell using ALT+10 char as separator
Dim splitVals As Variant
Dim totalVals As Long
splitVals = Split(ActiveCell.Value, Chr(10))
totalVals = UBound(splitVals)
Range(Cells(ActiveCell.Row, ActiveCell.Column + 1), Cells(ActiveCell.Row, ActiveCell.Column + 1 + totalVals)).Value = splitVals
End Sub
How does this code work?
- First we take the activecell’s value and split it based on Chr(10) as delimiter. This is the code for new lines.
- Then, we assign this split values to the range of cells adjacent to active cell.
- Then, we go grab a cup of coffee and sing our favorite song. Because the work is done!
Download Example Workbook
Click here to download example workbook and play with this macro. Make sure to enable macros.
How do you split text?
I really like the built-in text import feature in Excel and use it often. I use it to clean data, remove unnecessary columns or split text. In cases like this, I resort to VBA to have good control over how I want to split.
What about you? How do you split text. What is your experience. Please share your ideas and tips using comments.
Learn more about Splitting Text
If you split often, you will find this tutorial useful.
More VBA & Excel Macro Examples
If you want to learn VBA, go thru these examples
















6 Responses to “Nest Egg Calculator using Power BI”
Wow! What a Powerful article!
Hello Chandoo Sir
your file does not work with Excel 2016.
how can I try my hands on this powerful nest egg file ?
thanks
Ravi Santwani
@Ravi... this is a Power BI workbook. You need Power BI Desktop to view it. See the below tutorial to understand what Power BI is:
https://chandoo.org/wp/introduction-to-power-bi/
As always, superb article Chandoo... 🙂
Just one minor issue:
While following your steps and replicating this calculator in PowerBI, I found that the Growth Pct Parameters should be set as "Decimal number" not "Whole Number"
OR
we have to make corresponding adjustments in the Forecast formulas (i.e. divide by 100) to get accurate results.
You are right. I used whole number but modified the auto created harvester measure with /100 at end. Sorry I did not mention it in the tutorial.
Instead of
[Growth Pct 1 Value]/12
the monthly rate has to be
(1+[Growth Pct 1 Value])^(1/12)-1
It's a slight difference but in 30 years the future value will be $100k less.