Results 1 to 7 of 7

Thread: sum up values - Google Doc

  1. #1

    sum up values - Google Doc



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hi All,

    I have a spreadsheet with two columns and multiple rows. One column denotes item and the other one denotes value. However the value column has multiple values in italic, bold, normal formatting. I want to sum up the values based on the formatting. ie all italic values should sum up and so on.

    Thanks in Advance

  2. #2
    Super Moderator Pecoflyer's Avatar
    Join Date
    Oct 2011
    Location
    Brussels Belgium
    Posts
    1,314
    Articles
    0
    Excel Version
    2010 on Xubuntu
    Is the formatting the result of conditional formatting, and, if so, which are the conditions ?

  3. #3
    Quote Originally Posted by Pecoflyer View Post
    Is the formatting the result of conditional formatting, and, if so, which are the conditions ?
    No, There is no formatting, its manually done

  4. #4
    Good morning,

    As far as I am aware formatting options cannot be referenced by a formula. It is possible something like this could be solved with VBA, but I don't know for sure. However, if there is a system behind which numbers are formatted, we could work something out with a few helper columns and a sumifs formula. Also, assuming that the process is done in a rigid system, we could use conditional formatting to do all that and you wouldn't have to do it manually.

    Talk to you soon,

  5. #5
    Actually i am trying it in google drive spreesheet. Somehow i got the code for adding bold values. But still i dont know how to add up italic, italicbold, normal values
    Here is the code
    function SumBold(rangeSpecification) {

    var sheet = SpreadsheetApp.getActiveSpreadsheet();
    var range = sheet.getRange(rangeSpecification);

    var x = 0;

    for (var i = 1; i <= range.getNumRows(); i++) {
    for (var j = 1; j <= range.getNumColumns(); j++) {

    var cell = range.getCell(i, j);

    if(cell.getFontWeight() == 'bold')
    x += parseFloat(cell.getValue());
    }
    }

    return x;
    }
    HTML Code:
    if i change bold to italic or normal it dont work

  6. #6
    Super Moderator Pecoflyer's Avatar
    Join Date
    Oct 2011
    Location
    Brussels Belgium
    Posts
    1,314
    Articles
    0
    Excel Version
    2010 on Xubuntu
    I don't think MS Excel code will work with Google docs - Please refer to Google forums

  7. #7
    Super Moderator Zack Barresse's Avatar
    Join Date
    Mar 2011
    Location
    Oregon, United States
    Posts
    106
    Articles
    0
    I've moved the thread to a more appropriate forum.

    I'm not familiar with Google Doc automation, but wouldn't you need to not use "getFontWeight" to check italics? I don't know what the method would be, but I doubt you'll be able to check for italic in a Font Weight collection.
    Regards,
    Zack Barresse

Posting Permissions

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