+ Reply to Thread
Results 1 to 7 of 7

can't do arithmetic on cell containing a text string

  1. #1
    Registered User
    Join Date
    01-26-2012
    Location
    london
    MS-Off Ver
    Excel 365, v16.53
    Posts
    34

    can't do arithmetic on cell containing a text string

    Hello,

    In the attached spreadsheet:

    E1 is working as desired.

    E1 was copied down to give E2.

    But, because there is no value in D3, what it shows is #VALUE!

    This is because D3 contains a text string, and so arithmetic cannot be done on it.

    Anyone know how overcome this with VBA?
    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: can't do arithmetic on cell containing a text string

    i know you asked for VBA - but PRODUCT() will ignore blanks
    =IF(D3=0,"",PRODUCT($A$1,A3,D3))
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,906

    Re: can't do arithmetic on cell containing a text string

    Or simply this in E2 copied down:

    =IF(D2="","",$A$1*A2*D2)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: can't do arithmetic on cell containing a text string


    Hello, under VBA you can play with the Evaluate VBA function as well ...

  5. #5
    Registered User
    Join Date
    01-26-2012
    Location
    london
    MS-Off Ver
    Excel 365, v16.53
    Posts
    34

    Re: can't do arithmetic on cell containing a text string

    Hello Wayne, thanks so much

  6. #6
    Registered User
    Join Date
    01-26-2012
    Location
    london
    MS-Off Ver
    Excel 365, v16.53
    Posts
    34

    Re: can't do arithmetic on cell containing a text string

    Dear AliGW,

    What a brilliant solution!

    Thank you very much

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,906

    Re: can't do arithmetic on cell containing a text string

    Glad to have helped.

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, you may not be aware that you can thank those who have helped you by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of all those who offered help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Search cell A1 for text string from B1, replace with text string from C1
    By portokie in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-22-2019, 09:16 AM
  2. [SOLVED] Search for a text string and return given text string to adjacent cell
    By hecgroups in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-14-2015, 04:50 AM
  3. [SOLVED] IF range of cells contains string of text, return contents of cell where string is found
    By nobodyukno in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 07-03-2013, 09:56 AM
  4. [SOLVED] Find partial text string within another text string return original text into cell.
    By mikey42979 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-17-2013, 02:58 PM
  5. string to numeric not happening automatically in arithmetic functions
    By DaveKimble in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-05-2013, 10:17 AM
  6. Replies: 8
    Last Post: 08-07-2012, 10:15 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1