-
What is the Fibonacci Number Sequence?
Fibonacci series is a sequence of numbers. Any number in the list is a sum of last 2 numbers ahead of it (i.e., Last 2 preceding numbers).
This series can be generated in Excel using 2 methods.
- Using Excel VBA code
- Using Auto-fill & Sum Formula
In both methods, for a Fibonacci sequence, the first two numbers have to be explicitly mentioned. Sample series: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 … n.
Fibonacci Sequence Tool
There is special formula to find the Nth number in a Fibonacci series. But, in this article, we are just going to look at how to generate the series with Excel Macro.
- Open a new Excel workbook.
- Enter ‘0’ in A1, ‘1’ in A2. ’10’ in C3.
- Press Alt+F11 to view VB editor.
- Copy paste below code.
- Press F5 to execute the code.
1234567891011121314151617181920212223Sub Generate_Fibonacci_Series()Dim n1 As Double, n2 As Double, nTot As DoubleDim iRow As Double, Fibonacci As Doublen1 = ThisWorkbook.Sheets(1).Cells(1, 1) 'Enter First Number in Seriesn2 = ThisWorkbook.Sheets(1).Cells(2, 1) 'Enter Second Number in SeriesnTot = ThisWorkbook.Sheets(1).Cells(1, 3) 'Enter Total Numbers in SeriesiRow = 2'Generate Fibonacci SeriesWhile (nTot - 2) > 0Fibonacci = n1 + n2ThisWorkbook.Sheets(1).Cells(iRow + 1, 1) = Fibonacci'Get Next numbers to generate Fibonacci Seriesn1 = ThisWorkbook.Sheets(1).Cells(iRow, 1)n2 = ThisWorkbook.Sheets(1).Cells(iRow + 1, 1)iRow = iRow + 1nTot = nTot - 1WendMsgBox "Fibonacci Numbers Generated - Code From Officetricks.com"End Sub
Once executed, this will generate Fibonacci series in sheet1.Also Read: Excel VBA Convert - Amount (Numbers) To Words - Both US & India Formats
Fibonacci Series in Excel
This method used just the Sum formula & Auto-fill option. Using this we can generate any number of Fibonacci list in few minutes.
- Type ‘0’ in Cell A1.
- Type ‘1’ in Cell A2.
- Enter ‘=A1 + A2’ in Cell A3.
- Select cell A3.
- Drag the formula to N number of cells to get Fibonacci series.
We can change the first & second number to automatically get other Fibonacci numbers changed in order.
Previous Post: Microsoft Excel – Show Developer Tab – Enable VBA Macro Option
Next Post: Consolidate Data – In Excel Files – Create Summary Report
Fibonacci Sequence Number Generator – Excel Easy Trick
Post Categories
Popular Posts
Recent Posts
Similar Pages
Popular Tags
- Email Marketing Block Apps in FaceBook Task Manager print screen VCF HTML Table Import Data Candy Crush Outlook Record Macro android app development SEO Convert URL to IP HTML/ Javascript QR Code Generation VCARD Timer in Excel Countif Google+ bitcoin vba color index vba color codes Data Mining Android social media Twitter bulk email Google Adsense Tips Excel VBA Calendar in Excel Excel Macro WhatsApp Facebook mass email outlook vba Wordpress