+ Reply to Thread
Results 1 to 4 of 4

Difference Square for Solver: Improved Method Idea

  1. #1
    Registered User
    Join Date
    09-05-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    12

    Difference Square for Solver: Improved Method Idea

    So I'm trying to do some Gaussian peak fitting in excel. My real data has multiple peaks and some background, all of which I want to fit separately. I already know of to do this in an inelegant manner: I write the function in one column, and then take the difference squared in another column and then choose by hand the range in which to sum by editing a formula directly and then call the solver to do the dirty.

    I want a better way to do this. It can be done more elegantly if the sum of the differences squared between two columns could be computed in a single cell without creating a superfluous intermediate column (i.e. the difference squared column). I want to write a formula that looks like:

    =SumDiffSq("Range1", "Range2")

    That returns the difference squared between each element in range 1 and range 2 summed together. I'm relatively certain a person smarter than myself could do this using the built in excel functions, but I'm not seeing how to do it. Thoughts?

    Addendum: I've attached an excel file that contains representative data I'm trying to fit (It's x-ray scattering data for a nanocrystaline CdSe thin film if you're curious).
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,869

    Re: Difference Square for Solver: Improved Method Idea

    Is it possible that you want the =SUMXMY2() function? http://office.microsoft.com/en-us/ex...005209301.aspx

  3. #3
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Difference Square for Solver: Improved Method Idea

    For data in cols A & B, consider:

    =SUMPRODUCT(((A1:A10)-(B1:B10))^2)
    Gary's Student

  4. #4
    Registered User
    Join Date
    09-05-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Difference Square for Solver: Improved Method Idea

    MrShorty,

    That's perfect. Thank you so much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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