+ Reply to Thread
Results 1 to 6 of 6

how to add those numbers?

Hybrid View

  1. #1
    Mark
    Guest

    how to add those numbers?

    I have a column of numbers that I have to sum up,
    but there is one problem: some of them are formatted as a regular
    number (sometimes with decimals) and some are formatted as time
    (8:30 etc.)
    the regular sum(a:a) formula does not work on all of them
    is there any way to do it and get the result either in decimals or
    time or I'll have to redo the whole thing?

    Mark

  2. #2
    Dave Peterson
    Guest

    Re: how to add those numbers?

    I think I'd get all those numbers to a common unit (time or minutes or hours).

    If you have 30 in a cell (say A1) and it represents 30 minutes, you can use a
    helper cell and put a formula like:

    =A1/24/60

    (divide by the number of hours in a day then divide by the number of minutes in
    an hour.)

    Format that cell as time to see it nicely.

    Then you can use =sum()
    and use a custom format of:

    [hh]:mm:ss

    And you'll see your sum in total hours, minutes, seconds.



    Mark wrote:
    >
    > I have a column of numbers that I have to sum up,
    > but there is one problem: some of them are formatted as a regular
    > number (sometimes with decimals) and some are formatted as time
    > (8:30 etc.)
    > the regular sum(a:a) formula does not work on all of them
    > is there any way to do it and get the result either in decimals or
    > time or I'll have to redo the whole thing?
    >
    > Mark


    --

    Dave Peterson

  3. #3
    Bob Phillips
    Guest

    Re: how to add those numbers?

    If, and I accept that this might be a big If, all the non-time numbers are >
    1 you could use

    =SUMIF(A:A,"<=1")*24+SUMIF(A:A,">1")

    --
    HTH

    Bob Phillips

    "Mark" <123@hotmail.com> wrote in message
    news:mb2i919lrl736udssl9u8r2kui3p9ocj4p@4ax.com...
    > I have a column of numbers that I have to sum up,
    > but there is one problem: some of them are formatted as a regular
    > number (sometimes with decimals) and some are formatted as time
    > (8:30 etc.)
    > the regular sum(a:a) formula does not work on all of them
    > is there any way to do it and get the result either in decimals or
    > time or I'll have to redo the whole thing?
    >
    > Mark




  4. #4
    Mark
    Guest

    Re: how to add those numbers?

    On Sun, 29 May 2005 11:21:51 +0100, "Bob Phillips"
    <phillips@tiscali.co.uk> wrote:

    >If, and I accept that this might be a big If, all the non-time numbers are >
    >1 you could use
    >
    >=SUMIF(A:A,"<=1")*24+SUMIF(A:A,">1")



    thanks Bob, this works perfectly
    I only have one question:
    what those quotation marks do in this formula?

    Mark

  5. #5
    Bob Phillips
    Guest

    Re: how to add those numbers?

    Hi Mark,

    That is a good question.

    If you were testing for a straight equals a value, you would just use say

    =SUMIF(A:A,1)

    But if you want to test for less than, you would think you could use

    =SUMIF(A:A,<1)

    but you cannot, you have to wrap it with quotes which SUMIF evaluates

    =SUMIF(A:A,"<1")

    It gets more interesting if the value you want to compare is in another cell
    say B1. Straight equals comparison

    =SUMIF(A:A,B1)

    Less than comparison

    =SUMIF(A:A,"<"&B1)

    because the formula needs to get the value from B1, not the text B1, and the
    & is used to concatenate to a text value.

    --
    HTH

    Bob Phillips

    "Mark" <123@hotmail.com> wrote in message
    news:u16k91t59vd927qmma2djcl89iic7k6uvr@4ax.com...
    > On Sun, 29 May 2005 11:21:51 +0100, "Bob Phillips"
    > <phillips@tiscali.co.uk> wrote:
    >
    > >If, and I accept that this might be a big If, all the non-time numbers

    are >
    > >1 you could use
    > >
    > >=SUMIF(A:A,"<=1")*24+SUMIF(A:A,">1")

    >
    >
    > thanks Bob, this works perfectly
    > I only have one question:
    > what those quotation marks do in this formula?
    >
    > Mark




  6. #6
    Mark
    Guest

    Re: how to add those numbers?

    On Mon, 30 May 2005 12:07:35 +0100, "Bob Phillips"
    <phillips@tiscali.co.uk> wrote:

    >Hi Mark,
    >
    >That is a good question.
    >
    >If you were testing for a straight equals a value, you would just use say
    >
    >=SUMIF(A:A,1)
    >
    >But if you want to test for less than, you would think you could use
    >
    >=SUMIF(A:A,<1)
    >
    >but you cannot, you have to wrap it with quotes which SUMIF evaluates
    >
    >=SUMIF(A:A,"<1")
    >
    >It gets more interesting if the value you want to compare is in another cell
    >say B1. Straight equals comparison
    >
    >=SUMIF(A:A,B1)
    >
    >Less than comparison
    >
    >=SUMIF(A:A,"<"&B1)
    >
    >because the formula needs to get the value from B1, not the text B1, and the
    >& is used to concatenate to a text value.



    this was very educational,
    thank you very much Bob

    Mark

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1