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
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Hi.

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

=9+8+7+6

?

Regards
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,549
Messages
6,120,149
Members
448,948
Latest member
spamiki

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