sum up values - Google Doc

abhinav4

New member
Joined
Jan 15, 2014
Messages
3
Reaction score
0
Points
0
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
 
Is the formatting the result of conditional formatting, and, if so, which are the conditions ?
 
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,
 
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:
if i change bold to italic or normal it dont work
 
I don't think MS Excel code will work with Google docs - Please refer to Google forums
 
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.
 
Back
Top