Extracting numbers from a text and multiplying them numbers eachother

cadandcode

Board Regular
Joined
Jan 21, 2023
Messages
125
Office Version
  1. 2019
Platform
  1. Windows
  2. Mobile
Hello, I checked most of the topics but couldnt find the exact formula.

AB
14 M 10 AD40
220 M 7 AD140

I would like to get B2 results just like that from A1 and A2 columns. Extract 4 and 10 from A1 and multiply them eachother in B1 (B1 is just an example) like I tried to describe above.
I found a vba code to extract 4 and 10 from that text cell into B1 like "410" but I couldnt find a way to multiply them as "=4*10" in B1 instead of putting them together like "410".
 
@Fluff @awoohaw this solved it. No matter there is blanks between each or different kind of characters, that vba code directly takes and multiplies every single numbers into the cell where macro targeted. Great work guys, thank you for all your efforts so far!
thanks @Fluff.
 
Upvote 0

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
That code does exactly what the formula in post#2 does. :confused:
 
Upvote 0
But you said it works.
As long as you have something that works that's fine. (y)
 
Upvote 0
But you said it works.
As long as you have something that works that's fine. (y)
I tried it, now I remembered I have already tried it sir, it only takes first number.
 

Attachments

  • Adsız1.png
    Adsız1.png
    7.9 KB · Views: 7
Upvote 0
Are you trying that in 2021 or 2019?
 
Upvote 0
In that case you will need to confirm the formula with Ctrl Shift Enter rather than just Enter.
 
Upvote 0
In that case you will need to confirm the formula with Ctrl Shift Enter rather than just Enter.
I added sumproduct in beginning of your formula to make 2 cells that calculated by your formula sum in 1 cell. What is wrong with that line?
=SUMPRODUCT(PRODUCT(FILTERXML("<k><m>"&SUBSTITUTE(A2:A3," ","</m><m>")&"</m></k>","//m")))
 
Upvote 0

Forum statistics

Threads
1,215,494
Messages
6,125,139
Members
449,207
Latest member
VictorSiwiide

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