SUM by number format

Thanks:  0
Likes:  0

# Thread: SUM by number format

1. ## SUM by number format

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

2. ## Re: SUM by number format

Hi,

This would sum every second column. e.g. A1, C1 etc.

=SUMPRODUCT((MOD(COLUMN(A1:I1),2)*A1:I1))

Would that do?

3. ## Re: SUM by number format

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

4. ## Re: SUM by number format

Originally Posted by litrelord
...It won't solve my immediate problem since the percentages may not always be every other row but that is definitely an interesting formula. ...
You stated in your original post:

"The percentages are every other column and I don't want them to be inlcuded in the sum."

Now, what is the case?

5. ## Re: SUM by number format

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.

6. ## Re: SUM by number format

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.

## User Tag List

#### Posting Permissions

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