Results 1 to 6 of 6

SUM by number format

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. ...

  1. #1
    Board Regular
    Join Date
    Dec 2002
    Posts
    519

    Default 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. #2
    MrExcel MVP fairwinds's Avatar
    Join Date
    May 2003
    Posts
    8,633

    Default 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?
    "Fair Winds and Following Seas"

  3. #3
    Board Regular
    Join Date
    Dec 2002
    Posts
    519

    Default 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. #4
    MrExcel MVP Aladin Akyurek's Avatar
    Join Date
    Feb 2002
    Location
    The Hague, NL
    Posts
    65,910

    Default Re: SUM by number format

    Quote 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. #5
    Board Regular
    Join Date
    Dec 2002
    Posts
    519

    Default 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. #6
    MrExcel MVP fairwinds's Avatar
    Join Date
    May 2003
    Posts
    8,633

    Default 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.
    "Fair Winds and Following Seas"

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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


DMCA.com