extract numbers from cell

zubair99

New Member
Joined
Aug 8, 2015
Messages
49
Hi,
I need to extract numirical numbers from the cells and move to it's next cell.

see need to extract data below

[TABLE="width: 500"]
<tbody>[TR]
[TD]PICKLES (V.GF) PICKLED VEGETABLES & OLIVES 8
[/TD]
[TD]0.00[/TD]
[/TR]
[TR]
[TD]BATENGAN Bl FURN [V) OVEN-BAKED EGGPLANT AND FRESH TOMATOES SERVED WITH CHICKPEAS, CARAMELIZED ONION, MINT, CRUSHED GARLIC AND LEBANESE SPICES 17.5
[/TD]
[TD]0.00[/TD]
[/TR]
[TR]
[TD]HUMMUS WITH BREAD (V, GF) 9.5
[/TD]
[TD]0.00[/TD]
[/TR]
</tbody>[/TABLE]




I need this.

[TABLE="width: 500"]
<tbody>[TR]
[TD]PICKLES (V.GF) PICKLED VEGETABLES & OLIVES[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]BATENGAN Bl FURN [V) OVEN-BAKED EGGPLANT AND FRESH TOMATOES SERVED WITH CHICKPEAS, CARAMELIZED ONION, MINT, CRUSHED GARLIC AND LEBANESE SPICES [/TD]
[TD]17.5[/TD]
[/TR]
[TR]
[TD]HUMMUS WITH BREAD (V, GF)[/TD]
[TD]9.5[/TD]
[/TR]
</tbody>[/TABLE]

Please replay asap thanks.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hi,
The objective is to find the first number.

=MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789"))
will give you the position of the first number

=LEFT(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789"))-1 will give you the text

=MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),LEN(A1)+1-MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")
will give you the number

Hope it helps.
Puneet
 
Upvote 0
zubair99,

How about something like this?


Excel 2007
AB
1PICKLES (V.GF) PICKLED VEGETABLES & OLIVES 88
2BATENGAN Bl FURN [V) OVEN-BAKED EGGPLANT AND FRESH TOMATOES SERVED WITH CHICKPEAS, CARAMELIZED ONION, MINT, CRUSHED GARLIC AND LEBANESE SPICES 17.517.5
3HUMMUS WITH BREAD (V, GF) 9.59.5
Sheet1
Cell Formulas
RangeFormula
B1=MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),99)+0


The formula in cell B1, copied down:

=MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),99)+0
 
Upvote 0
I need this.

[TABLE="width: 500"]
[TR]
[TD]PICKLES (V.GF) PICKLED VEGETABLES & OLIVES[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]BATENGAN Bl FURN [V) OVEN-BAKED EGGPLANT AND FRESH TOMATOES SERVED WITH CHICKPEAS, CARAMELIZED ONION, MINT, CRUSHED GARLIC AND LEBANESE SPICES [/TD]
[TD]17.5[/TD]
[/TR]
[TR]
[TD]HUMMUS WITH BREAD (V, GF)[/TD]
[TD]9.5[/TD]
[/TR]
[/TABLE]
Try these two formulas, copied down.
I've assumed, like your samples, the number you want is always at the end, and there are no other numbers in your data.

Excel Workbook
ABC
2PICKLES (V.GF) PICKLED VEGETABLES & OLIVES 8PICKLES (V.GF) PICKLED VEGETABLES & OLIVES8
3BATENGAN Bl FURN [V) OVEN-BAKED EGGPLANT AND FRESH TOMATOES SERVED WITH CHICKPEAS, CARAMELIZED ONION, MINT, CRUSHED GARLIC AND LEBANESE SPICES 17.5BATENGAN Bl FURN [V) OVEN-BAKED EGGPLANT AND FRESH TOMATOES SERVED WITH CHICKPEAS, CARAMELIZED ONION, MINT, CRUSHED GARLIC AND LEBANESE SPICES17.5
4HUMMUS WITH BREAD (V, GF) 9.5HUMMUS WITH BREAD (V, GF)9.5
Extract Number
 
Upvote 0
If that is not always true, then here is an alternative formula for column B.

Extract Number (2)

*ABC
PICKLES (V.GF, 18% Sugar) PICKLED VEGETABLES & OLIVES 8PICKLES (V.GF, 18% Sugar) PICKLED VEGETABLES & OLIVES

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:464px;"><col style="width:464px;"><col style="width:57px;"></colgroup><tbody>
[TD="bgcolor: #cacaca, align: center"]2[/TD]

[TD="align: right"]8[/TD]

</tbody>

Spreadsheet Formulas
CellFormula
B2=LEFT(A2,FIND("ß",SUBSTITUTE(A2," ","ß",LEN(A2)-LEN(SUBSTITUTE(A2," ",""))))-1)
C2=RIGHT(SUBSTITUTE(A2," ",REPT(" ",100)),100)+0

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4

I have one more pattern need to extract this.



[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]SANPELLEGRINO LIMONATA, ARAN Cl AT A ROSSA, CHINOTTO, MINERAL WATER (250ML) 4.5 MINERAL WATER (500ML) 7


[/TD]
[TD]0.00[/TD]
[/TR]
[TR]
[TD]TEA PEPPERMINT, EARL GREY, ENGLISH BREAKFAST, GREEN, CHAMOMILE, VANILLA CHAI 4
[/TD]
[TD]0.00[/TD]
[/TR]
[TR]
[TD]COFFEE 3.8/48
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

need it.

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]SANPELLEGRINO LIMONATA, ARAN Cl AT A ROSSA, CHINOTTO, MINERAL WATER (250ML) 4.5 MINERAL WATER (500ML) 7[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]TEA PEPPERMINT, EARL GREY, ENGLISH BREAKFAST, GREEN, CHAMOMILE, VANILLA CHAI 4[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]COFFEE 3.8/48
[/TD]
[TD]3.8/48[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
I have one more pattern need to extract this.

need it.

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]SANPELLEGRINO LIMONATA, ARAN Cl AT A ROSSA, CHINOTTO, MINERAL WATER (250ML) 4.5 MINERAL WATER (500ML) 7[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]TEA PEPPERMINT, EARL GREY, ENGLISH BREAKFAST, GREEN, CHAMOMILE, VANILLA CHAI 4[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]COFFEE 3.8/48
[/TD]
[TD]3.8/48[/TD]
[/TR]
</tbody>[/TABLE]
You are no longer necessarily extracting a number from the end, as that last example is text, not a number.

Try
=TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",100)),100))
 
Last edited:
Upvote 0
zubair99,

Have you tried my other formula in my reply #3?

How about something like this?


Excel 2007
ABC
1SANPELLEGRINO LIMONATA, ARAN Cl AT A ROSSA, CHINOTTO, MINERAL WATER (250ML) 4.5 MINERAL WATER (500ML) 777
2TEA PEPPERMINT, EARL GREY, ENGLISH BREAKFAST, GREEN, CHAMOMILE, VANILLA CHAI 444
3COFFEE 3.8/483.8/483.8/48
4
Sheet1
Cell Formulas
RangeFormula
B1=TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",LEN(A1))),LEN(A1)))
C1=TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",300)),300))
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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