+ Reply to Thread
Results 1 to 5 of 5

dont understand hyphen hyphen

  1. #1
    Registered User
    Join Date
    08-13-2011
    Location
    Santa Cruz, Cali, US
    MS-Off Ver
    Excel 2007
    Posts
    41

    dont understand hyphen hyphen

    hi all,
    so i had this problem.

    i was doing =sumproduct(A1:A10,B1:B10)

    however sometimes either a value in A column or B column is blank, so I wanted to ignore that.

    I managed to get it to work by using this formula:
    =SUMPRODUCT(--(A1:A10),--(B1:B10))

    i have no idea what that hyphen hyphen does, can you please help me understand

    thanks

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: dont understand hyphen hyphen

    There are many explanations of this floating around. Below is a link to one.
    Do a forum search for "Double Unary" and you'll find lots of information.

    http://www.excelforum.com/excel-gene...-operator.html

  3. #3
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: dont understand hyphen hyphen

    I have seen this is a way to convert numbers that are actually text to real numbers....
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: dont understand hyphen hyphen

    I'm not sure I understand the problem...

    =sumproduct(A1:A10,B1:B10)

    That formula DOES ignore blanks..

    Perhaps you just posted a simplified version of a more complicated formula?

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: dont understand hyphen hyphen

    Essentially, you are taking a text "value" and converting it to a numeric by giving it a minus sign (-). Then, to convert that back to a positive, you give it another minus sign (yes Bart, 2 wrongs do make a right lol)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Getting rid of hyphen
    By Rogermb in forum Excel General
    Replies: 2
    Last Post: 02-01-2008, 11:35 AM
  2. ...I want to display a hyphen instead of zero...
    By Dr. Darrell in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 06:05 PM
  3. [SOLVED] ...I want to display a hyphen instead of zero...
    By Dr. Darrell in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 PM
  4. [SOLVED] ...I want to display a hyphen instead of zero...
    By Dr. Darrell in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM
  5. [SOLVED] ...I want to display a hyphen instead of zero...
    By Dr. Darrell in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM

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