extract numbers from formula in excel

littlepuppy

New Member
Joined
Jun 8, 2015
Messages
2
Hey guys,:p

I want to extract the numbers out from the formula in excel.
For example,

30=9+8+7+6 the number in the cell is 30. The 30 comes from 4 different numbers. I want to get each of the number out separately, like 9, 8, 7, and 6. each of them separately.

8,450,668.83=38062098.32-29611347.24-82.25
Same as here. The cell number 8,450,668.83 comes from three different numbers. How to get 38062098.32, -29611347.24, -82.25 out and each of them separately.

Thank you :p
 

Some videos you may like

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

XOR LX

Well-known Member
Joined
Jul 2, 2012
Messages
4,517
Hi.

Not sure I understand. What's actually in the cell? The formula:

=9+8+7+6

?

Regards
 

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,873
Office Version
  1. 2010
Platform
  1. Windows
If I understand your question correctly, give this macro a try...
Code:
Sub GetNumbersFromSimpleFormula()
  Dim Frmla As String, Cell As Range, Nums As Variant
  For Each Cell In Range("A1", Cells(Rows.Count, "A").End(xlUp))
    Frmla = Cell.Formula
    Nums = Split(Replace(Mid(Frmla, 2), "-", "+"), "+")
    With Cell.Offset(, 1).Resize(, UBound(Nums) + 1)
      .Value = Nums
      .Value = .Value
    End With
  Next
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,127,582
Messages
5,625,621
Members
416,124
Latest member
DeMoNloK

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
Top