+ Reply to Thread
Results 1 to 12 of 12

Getting Excel multiplication to ignore minus numbers

  1. #1
    Registered User
    Join Date
    09-09-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    45

    Getting Excel multiplication to ignore minus numbers

    Hi,

    If I wanted to get a cell, say A1, to multiply a value, for example 7, by the results in another cell, say B1, but NOT multiply if that cell's value is a minus number, is there a way of getting Excel to do that?

    Normally I'd just type =SUM(A1*B1)*7, but how can that be reconfigured to ignore minus numbers? e.g. if B1 contained -5, ?

    thanks,

    KM

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Getting Excel multiplication to ignore minus numbers

    Try:

    =7*A1*IF(B1<0,1,B1))
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Getting Excel multiplication to ignore minus numbers

    If don't want to multiply if either value is negative:

    =IF(A1*B1<0,"",A1*B1*7)

    If you just want to ignore signs:

    =ABS(A1*B1*7)

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Getting Excel multiplication to ignore minus numbers

    If don't want to multiply if either value is negative:

    =IF(A1*B1<0,"",A1*B1*7)
    Stephen ...
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    09-09-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Getting Excel multiplication to ignore minus numbers

    Sorry Stephen, I've asked a bad question -

    What I meant was how do I multiply a cell, for example A1, by 7, but only if A1 is positive... which I think is slightly different to what I asked!!!

    hope you can still help - stupid mistake.

  6. #6
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Getting Excel multiplication to ignore minus numbers

    This:
    =SUM(A1*B1)*7
    is unneccessary
    =A1*B1*7
    does the same thing and is easier to understand

    This
    =A1*max(B1,0)*7
    returns 0 if B1 is negative

    This:
    =A1*abs(B1)*7
    turns B1 into a positive if it's negative

    and this:
    =A1*IF(SIGN(B1)=-1,1,B1)*7
    (edit) or just
    =A1*IF(B1<0,1,B1)*7
    I seem to have sign stuck in my head atm...

    "ignores" B1 in the equation if it's negative

    HTH
    Last edited by Cheeky Charlie; 10-07-2009 at 01:11 PM.

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Getting Excel multiplication to ignore minus numbers

    What I meant was how do I multiply a cell, for example A1, by 7, but only if A1 is positive
    =7*A1*(A1>0) (returns 0 if A1<0)

    or

    =IF(A1>0, 7*A1, "") (returns "" if A1<0)

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Getting Excel multiplication to ignore minus numbers

    or did you mean?

    =7*B1*IF(A1<0,1,A1))

  9. #9
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Getting Excel multiplication to ignore minus numbers

    errm...

    How about
    =A1*IF(A1>0,B1,1)
    or
    =A1*IF(A1>0,7,1)

    This is confused me.

  10. #10
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Getting Excel multiplication to ignore minus numbers

    shg - well I did say either not both. Does that wash? No, I'll get my coat.

    What I meant was how do I multiply a cell, for example A1, by 7, but only if A1 is positive... which I think is slightly different to what I asked!!!
    =IF(A1>0,A1*7,"A1 negative")

  11. #11
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,578

    Re: Getting Excel multiplication to ignore minus numbers

    or IF(ISNUMBER(IMAGINARY(A1)),=7*B1*IMABS(A1),7*B1*IF(A1<0,1,A1))

    if you're working with imaginary numbers.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  12. #12
    Registered User
    Join Date
    02-20-2013
    Location
    Adealide, Australia
    MS-Off Ver
    Excel 2010
    Posts
    30

    Red face Re: Getting Excel multiplication to ignore minus numbers

    Quote Originally Posted by StephenR View Post
    shg - well I did say either not both. Does that wash? No, I'll get my coat.


    =IF(A1>0,A1*7,"A1 negative")
    Awesome.....you solved my problem too. thank you, thank you

+ 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