+ Reply to Thread
Results 1 to 7 of 7

Want to Add x+2x and result will be 3x How can I do this

  1. #1
    Registered User
    Join Date
    06-14-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    6

    Want to Add x+2x and result will be 3x How can I do this

    Dear all,


    I am a beginner in MS office and i created a excel data base for my uncle. there is filed contains the data as "x". I want add this text.

    ie. the cells contains the values like x, 2x,x,3x etc. and I want the result as

    x+2x+x+3x=7x.

    I am using "Countif" but I got the answer as 4.

    please anybody help me to resolve this problem.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Want to Add x+2x and result will be 3x How can I do this

    So mockup a sample workbook showing the need and your desired results, point out where the results came from if not obvious in your sample data.


    Then click GO ADVANCED and use the paperclip icon to post up your workbook.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Want to Add x+2x and result will be 3x How can I do this

    If we assume

    A1:A4

    x
    2x
    x
    3x

    Then

    A5: =SUM(IF(A1:A4="x",1,LEN(REPT("x",SUBSTITUTE(A1:A4,"x","")))))
    committed with CTRL + SHIFT + ENTER

    would return 7

  4. #4
    Forum Contributor mubashir aziz's Avatar
    Join Date
    03-18-2009
    Location
    Lahore, Pakistan
    MS-Off Ver
    MS Office 2013
    Posts
    533

    Re: Want to Add x+2x and result will be 3x How can I do this

    @DK if A4 isblank then formula will return error .....

    Should we use If(iserro(formula),0,formula) or there is a simple solution without executing formula twice ??
    If this post helps, Please don't 4get to click the star icon located at the bottom left of my Post.

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Want to Add x+2x and result will be 3x How can I do this

    A few options... one:

    =SUM(IF((A1:A4="x")+(A1:A4=""),1*(A1:A4="x"),LEN(REPT("x",SUBSTITUTE(A1:A4,"x","")))))
    committed with CTRL + SHIFT + ENTER

  6. #6
    Forum Contributor mubashir aziz's Avatar
    Join Date
    03-18-2009
    Location
    Lahore, Pakistan
    MS-Off Ver
    MS Office 2013
    Posts
    533

    Re: Want to Add x+2x and result will be 3x How can I do this

    Thx DK for your valuable suggestion ....

  7. #7
    Registered User
    Join Date
    06-14-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    6

    Smile Re: Want to Add x+2x and result will be 3x How can I do this

    thanks a lot..it's amazing it is working...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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