+ Reply to Thread
Results 1 to 8 of 8

Sum by condtion

Hybrid View

  1. #1
    Registered User
    Join Date
    08-24-2006
    Posts
    8

    Sum by condtion

    I'm don't think this is the right terminology, so I'm not sure what to search for. Please excuse me if this topic has already been discussed.

    Here's what I want to do is sum numbers from all states listed in a cell. I have a list of states on sheet one, column b, and numbers in column c. on sheet two, i have regions, for example "Region 1 - Maine, Vermont, New Hampshire, Massachusetts, Connecticut, New York, Rhode Island". Is there a way to get totals based on that? or would i need to separate out the states and do a lookup for each before summing?

    I think that was confusing. let me know if i can clarify.

    Thanks!

  2. #2
    Forum Contributor wmorrison49's Avatar
    Join Date
    09-25-2007
    Posts
    267
    So do you want the sum by state, the sum by region, or both?

  3. #3
    Registered User
    Join Date
    08-24-2006
    Posts
    8
    Sum by region

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Take a look at sumproduct

    http://www.xldynamic.com/source/xld.SUMPRODUCT.html

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  5. #5
    Forum Contributor wmorrison49's Avatar
    Join Date
    09-25-2007
    Posts
    267
    Attach your spreadsheet and I will take a look at writing some code if the sumproduct help that VBA Noob posted didn't work.

  6. #6
    Registered User
    Join Date
    08-24-2006
    Posts
    8
    I appreciate the offer to write code, but if it's not a formula in a cell, i can go ahead and break out the states into separate cells, and sum using those. it'll only take a couple minutes.

    originally, i was going to use autohotkey to match the states in the string, but that seemed incredibly involved for what seems like it should be simple.

    looks like there's no formula to match parts of a string in a cell.

+ 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