Hi,
This would sum every second column. e.g. A1, C1 etc.
=SUMPRODUCT((MOD(COLUMN(A1:I1),2)*A1:I1))
Would that do?
This is a discussion on SUM by number format within the Excel Questions forums, part of the Question Forums category; Hello again, I've got rows of data which have a mixture of numbers and percentages which I need to sum. ...
Hello again,
I've got rows of data which have a mixture of numbers and percentages which I need to sum. The percentages are every other column and I don't want them to be inlcuded in the sum. What I did to get the addresses for the cells I wanted summed was to write a piece of code that gave me a string that I could paste e.g. A1,C1,E1,G1 ETC
This is fine and it worked OK but I want to know if there's a forumla I could use instead. I was trying for a while to use SUMIF with the CELL function to look at the number format and see whether it was a percentage or not but coulsn't get it to work.
Does anyone have any ideas on a formula for this as it would be a hell of a lot nicer than using VBA?
Thanks
Nick
Hi,
This would sum every second column. e.g. A1, C1 etc.
=SUMPRODUCT((MOD(COLUMN(A1:I1),2)*A1:I1))
Would that do?
"Fair Winds and Following Seas"
Hi fairwinds,
thanks for that. It won't solve my immediate problem since the percentages may not always be every other row but that is definitely an interesting formula. I'd never used the MOD function before and I have to say I'm quite impressed. Mostly because I've always liked using the COLUMN function in formulas and then using fill, what a godsend. Anyway, I digress. Thanks again, if you think of any other ideas (or anyone else for that matter) I'd be happy to hear them.
Nick
You stated in your original post:Originally Posted by litrelord
"The percentages are every other column and I don't want them to be inlcuded in the sum."
Now, what is the case?
yeah sorry, I'm contradicting myself here. This time around it's every other column but next time or the time after it may not be.
As I said, the formula from fairwinds is nice but i was hoping to be able to sum by number format. Well, not so much hoping but interested in finding a way to do it.
Well, I think the best way is to put a special heading in the columns you want to sum / not sum and use a SUMIF.
I don't think you can sum by format with a formula.
"Fair Winds and Following Seas"
Like this thread? Share it with others