+ Reply to Thread
Results 1 to 19 of 19

sum a range with multiple symbols and assign different values for each question

  1. #1
    Valued Forum Contributor
    Join Date
    03-17-2007
    Location
    Michigan
    MS-Off Ver
    Excel 2021
    Posts
    974

    sum a range with multiple symbols and assign different values for each question

    Hello, I've spent several hours trying to research this question on my own but to no avail. I have a range from c5 to ag5 and I need a formula which would look at each cell in that range and first identify the symbols (if present) in that range and then sum the value for each symbol. The symbols would be something like "8V", which I want to have a value of 8, "7.5V" would equal 7.5 and so forth all the way down to ".5V", etc. thus summing the total vacation hours for that range.
    I've tried sumifs, sumproduct, vlookup formulas unsuccessfully. Any assistance would be appreciated.

    example:
    c5, d5, e5, f5, g5,
    8V 4.5V 1V .5V Total from formula should give me 14
    Last edited by lilsnoop; 01-03-2013 at 12:46 PM. Reason: example needed to be fixed...oops

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: sum a range with multiple symbols and assign different values for each question

    hi lilsnoop. so is where data in row 5 or in column C? using your eg in C5:C9, try this array formula:
    =SUM(SUBSTITUTE(C5:C9,"v","")+0)

    press CTRL + SHIFT + ENTER to confirm

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Valued Forum Contributor
    Join Date
    03-17-2007
    Location
    Michigan
    MS-Off Ver
    Excel 2021
    Posts
    974

    Re: sum a range with multiple symbols and assign different values for each question

    My apologies! It's getting late and I gave a poor example, which I've now fixed thanks to your reply. I meant to have the formula cross an entire row from c5 to ag5. Sorry for the confusion.

  4. #4
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: sum a range with multiple symbols and assign different values for each question

    Maybe this regular formula

    Please Login or Register  to view this content.
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  5. #5
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: sum a range with multiple symbols and assign different values for each question

    =SUMPRODUCT(--SUBSTITUTE(C5:F5,"v",))

    Normally Enter

  6. #6
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: sum a range with multiple symbols and assign different values for each question

    Note: Substitute() is case sensitive. If OP mixed "V" & "v" upper case and lower case then my previous formula fail, and benishiryo formula also fail.

    Correction:

    =SUMPRODUCT(--(SUBSTITUTE(SUBSTITUTE(C5:F5,"v",),"V",)))

  7. #7
    Valued Forum Contributor
    Join Date
    03-17-2007
    Location
    Michigan
    MS-Off Ver
    Excel 2021
    Posts
    974

    Re: sum a range with multiple symbols and assign different values for each question

    Thank you for your replies and thoughts reference this problem. For each of them I get a "#VALUE". I believe it is because I haven't attributed a value to any "V" symbol.

    Initially I thought I'd need a sumproduct formula something like:
    Please Login or Register  to view this content.
    But I get 3291.5 and not 14 like I should with the test workbook I've attached. Any other suggestions?
    Attached Files Attached Files

  8. #8
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: sum a range with multiple symbols and assign different values for each question

    Try this array formula, confirm with Ctrl+Shift+Enter, not just Enter.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    [EDIT]
    This CSE array does the same
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by Marcol; 01-03-2013 at 09:08 AM.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  9. #9
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: sum a range with multiple symbols and assign different values for each question

    Try this variation of benishiryo's array formula

    Please Login or Register  to view this content.
    Remember to Ctrl+Shift+Enter

  10. #10
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: sum a range with multiple symbols and assign different values for each question

    Quote Originally Posted by Ace_XL View Post
    Try this variation of benishiryo's array formula

    Please Login or Register  to view this content.
    Remember to Ctrl+Shift+Enter
    Your formula is case sensitive, but it might not matter, depends if "V" is a unit e.g. Volts/Vacation, or purely a "symbol".
    I suspect the solution would be better not to being case sensitive.
    Last edited by Marcol; 01-03-2013 at 09:38 AM.

  11. #11
    Valued Forum Contributor
    Join Date
    03-17-2007
    Location
    Michigan
    MS-Off Ver
    Excel 2021
    Posts
    974

    Re: sum a range with multiple symbols and assign different values for each question

    Thanks so much to all of you!

  12. #12
    Valued Forum Contributor
    Join Date
    03-17-2007
    Location
    Michigan
    MS-Off Ver
    Excel 2021
    Posts
    974

    Re: sum a range with multiple symbols and assign different values for each question

    Thanks so much to all of you! Quick question, Marcol I like your formula
    Please Login or Register  to view this content.
    but I was wondering how I could use it for totaling other symbols without messing up others. Meaning the formula you gave me will calculate the total vacation hours in the range from c5 to ag5. I'd also like to in another cell calculate how much personal leave time used, which is symbolized as "8PL" etc, and I'll have one that will have a symbol "7.5PLv", etc. My question is the formula gives me a #VALUE for symbols with more than one letter. I notice that the "7.5PLv" symbol will confuse my earlier "vacation" total too as the small "v in the PLv" confuses it or so I suspect. I tried the formula you said for the letter casing , but it doesn't work for me. Thanks again for your help!
    Last edited by lilsnoop; 01-03-2013 at 10:51 AM.

  13. #13
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: sum a range with multiple symbols and assign different values for each question

    You are making it hard by having some short codes that are found in your longer codes.

    If you are to have single letter codes/flags, then these letters should not occur in any other code/flag.

    Best that all codes/flags are unique.

    See this worksheet for the formula adapted to handle any length of code/flag.
    Attached Files Attached Files

  14. #14
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,656

    Re: sum a range with multiple symbols and assign different values for each question

    Normal working time records have multi rows for staffs and multi columns (1-31) for days of month, then Total days.
    Each day, staffs will be recorded by, i.e : "8Plv","7PL","LV","V"...or other symbols.
    I think we need to sum hours for each staff each symbol in the total columns, each symbol per column, at most right columns
    Assuming AH4:AK4 is the four symbols: "Plv","PL","LV","V"
    AH5 is the total of "Plv" of 1st staff:
    =SUM(IFERROR(--SUBSTITUTE(UPPER($C5:$AG5),UPPER(AH$4),""),0),)
    Confirmed with Ctrl-Shift-Enter
    Drag across to AK5, then down
    Attached Files Attached Files
    Quang PT

  15. #15
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,656

    Re: sum a range with multiple symbols and assign different values for each question

    @Marcol, I am afraid that there is a mess with sth like "PL" and "PLV"...

  16. #16
    Valued Forum Contributor
    Join Date
    03-17-2007
    Location
    Michigan
    MS-Off Ver
    Excel 2021
    Posts
    974

    Re: sum a range with multiple symbols and assign different values for each question

    You guys have been extremely helpful!!

  17. #17
    Valued Forum Contributor
    Join Date
    03-17-2007
    Location
    Michigan
    MS-Off Ver
    Excel 2021
    Posts
    974

    Re: sum a range with multiple symbols and assign different values for each question

    Thanks bebo & Marcol!

  18. #18
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,656

    Re: sum a range with multiple symbols and assign different values for each question

    You are welcome!

  19. #19
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: sum a range with multiple symbols and assign different values for each question

    Quote Originally Posted by bebo021999 View Post
    @Marcol, I am afraid that there is a mess with sth like "PL" and "PLV"...
    As I said, short codes should not be contained in any of the longer codes, it just makes the problem unnecessarily complicated.
    Best if the codes are all the same length.

+ 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