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".
 

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 & welcome to MrExcel.
How about
Fluff.xlsm
AB
1
24 M 10 AD40
320 M 7 AD140
Master
Cell Formulas
RangeFormula
B2:B3B2=PRODUCT(FILTERXML("<k><m>"&SUBSTITUTE(A2," ","</m><m>")&"</m></k>","//m"))
 
Upvote 0
Hi & welcome to MrExcel.
How about
Fluff.xlsm
AB
1
24 M 10 AD40
320 M 7 AD140
Master
Cell Formulas
RangeFormula
B2:B3B2=PRODUCT(FILTERXML("<k><m>"&SUBSTITUTE(A2," ","</m><m>")&"</m></k>","//m"))
1674318165497.png

Thank you for your kind welcome and quick help sir, it gives that error when I type formula in B2 cell.
 
Upvote 0
as long as you always have the M and AD the same this is an option:
WorkBook1.xlsx
AB
1
2
34 M 10 AD40
420 M 7 AD140
5
Sheet4
Cell Formulas
RangeFormula
B3:B4B3=LEFT(A3,FIND(" M",A3)-1) * LEFT(SUBSTITUTE(A3,LEFT(A3,FIND("M ",A3)+1),""),FIND(" A",SUBSTITUTE(A3,LEFT(A3,FIND("M ",A3)+1),""))-1)
 
Upvote 0
as long as you always have the M and AD the same this is an option:
WorkBook1.xlsx
AB
1
2
34 M 10 AD40
420 M 7 AD140
5
Sheet4
Cell Formulas
RangeFormula
B3:B4B3=LEFT(A3,FIND(" M",A3)-1) * LEFT(SUBSTITUTE(A3,LEFT(A3,FIND("M ",A3)+1),""),FIND(" A",SUBSTITUTE(A3,LEFT(A3,FIND("M ",A3)+1),""))-1)
I changed all "," to ";" and it worked.

Do you normally use commas as the separator in a formula, or do you use semi-colons?
I think it is ";" because I changed @awoohaw 's all "," symbols to ";" and it worked.
Why did that difference occure?
 
Upvote 0
Some countries use the ; as a separator & some use , You just need to use your normal separator.
 
Upvote 0
Some countries use the ; as a separator & some use , You just need to use your normal separator.
Thank you and how can I multiply them numbers from A1, A2, A3.... A99... and sum all in B1? Like B1=4*10+20*7+......
 
Upvote 0
With your version of excel, you probably better off putting the formula in col B, fill down & then add all the results up.
 
Upvote 0
With your version of excel, you probably better off putting the formula in col B, fill down & then add all the results up.
I think it didnt work, one cell (B1) can get result of A1 (4*10) and I believe we can put there some (+) and add other cells, tried to make it A1:A4 to perform that extract and multiply process from cells A1 to A4 but it just gave A1 results.
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,728
Members
448,987
Latest member
marion_davis

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