Performing math function with cells containing numbers & text

meighkee

New Member
Joined
Sep 3, 2008
Messages
43
Greetings,

I need some help. Am perform basic multiplication between two cells, one containing numbers & text.

Example -
Cell A1 - contains the number 5
Cell A2 - contains the words "5 days"
Cell A3 - I'd like to multiply A1 times A2 and come up with 25.

The word "days" in A2 is creating an issue. There must be a way for Excel to see only the number 5 in A2, and perform the multiplication formula accordingly.

Am hoping someone can help.

Thank you.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
If your text will always be "days", then something like this.
Excel Workbook
A
15
25 days
325
Sheet
 
Upvote 0
Hi,

If the word(s) can be anything, but the Number is Always at the beginning (leftmost) of the Text string:


Book1
ABCD
15555
25 days6 weeks7 text11 long years
325303555
Sheet577
Cell Formulas
RangeFormula
A3=LEFT(A2,FIND(" ",A2))*A1
 
Upvote 0
If your text will always be "days", then something like this.


A
5 days

<colgroup><col style="width:30px; "><col style="width:64px;"></colgroup><tbody>
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]1[/TD]
[TD="align: right"]5[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]2[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]3[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] , align: right"]25[/TD]

</tbody>

Spreadsheet Formulas
CellFormula
A3=SUBSTITUTE(A2,"days","")*A1

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4

Thank you very much. Looks like it will do just fine.
 
Upvote 0
If your text will always be "days", then something like this.


A
5 days

<colgroup><col style="width:30px; "><col style="width:64px;"></colgroup><tbody>
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]1[/TD]
[TD="align: right"]5[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]2[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]3[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] , align: right"]25[/TD]

</tbody>

Spreadsheet Formulas
CellFormula
A3=SUBSTITUTE(A2,"days","")*A1

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4

Again, thanks very much for the quick response. I do, however, have one modification I'd appreciate your help with. I used the example '5 days' before but the actual cell will contain text, a number, then text again. Example: "For 5 Days". I tried modifying your formula in various ways to see if I could get it to work with those cell contents but to no avail. So, I'm back for your expertise one more time. Thank you very much.
 
Upvote 0
Again, thanks very much for the quick response. I do, however, have one modification I'd appreciate your help with. I used the example '5 days' before but the actual cell will contain text, a number, then text again. Example: "For 5 Days". So the number will actually be in the middle of both words. I tried modifying your formula in various ways to see if I could get it to work with those cell contents but to no avail. So, I'm back for your expertise one more time. Thank you very much.
 
Upvote 0
Cell Formula
A3 =TRIM(SUBSTITUTE(SUBSTITUTE(A2,"For",""),"Days",""))*A1
 
Upvote 0
Is that the Only possible format for your Text strings, "For # Days" ?
If not, please show a few samples of All possibilities.
I also need to know if there may be more than 1 number within the Text string, like "For # Days and # Months"
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

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