+ Reply to Thread
Results 1 to 6 of 6

Formula for finding the average of a range (two numbers separated by a hyphen)

  1. #1
    Registered User
    Join Date
    12-03-2007
    Location
    Singapore
    MS-Off Ver
    Professional Plus 2010
    Posts
    45

    Formula for finding the average of a range (two numbers separated by a hyphen)

    If I have a range in cell A1 (e.g. 3.76-4.32) and want to put the midpoint of the range (4.04) in B1, what formula should I put in B1? What number format (general, number, text) should A1 be?

  2. #2
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,478

    Re: Formula for finding the average of a range (two numbers separated by a hyphen)

    Give this formula a try...

    =AVERAGE(LEFT(A1,FIND("-",A1)-1),MID(A1,FIND("-",A1)+1,99))

  3. #3
    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
    53,051

    Re: Formula for finding the average of a range (two numbers separated by a hyphen)

    Rick, as always, has brilliant formulas.

    But I just want to point out that any time you have numbers/values in a cell, that also include any text (like - for instance, or 2 .'s), that number becomes text. Then fancy formulas are needed to convert that text back to values so that you can run formulas and clacs like you want.
    Ir is almost always better (and simpler) to keep each number in it's own cell, then this would have been a simple average() function
    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

  4. #4
    Registered User
    Join Date
    12-03-2007
    Location
    Singapore
    MS-Off Ver
    Professional Plus 2010
    Posts
    45

    Re: Formula for finding the average of a range (two numbers separated by a hyphen)

    Quote Originally Posted by Rick Rothstein View Post
    Give this formula a try...

    =AVERAGE(LEFT(A1,FIND("-",A1)-1),MID(A1,FIND("-",A1)+1,99))
    That worked. Thanks. The number formatting for A1 was "general". Also, for the range, you must use "-" Hyphen-Minus (character code: 002D), not "—" Em Dash (2014), or "–" En Dash (2013).
    Last edited by tukae; 08-30-2019 at 12:33 AM.

  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
    53,051

    Re: Formula for finding the average of a range (two numbers separated by a hyphen)

    Formatting doesnt really work of=n text cells. And formatting only changes the appearance of a cell, not it's contents.

  6. #6
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,478

    Re: Formula for finding the average of a range (two numbers separated by a hyphen)

    Quote Originally Posted by tukae View Post
    Also, for the range, you must use "-" Hyphen-Minus (character code: 002D), not "—" Em Dash (2014), or "–" En Dash (2013).
    Do you need the flexibility to use Em and En dashes as well as normal dashes? If so, give this formula a try...

    =AVERAGE(LEFT(A1,FIND("-",SUBSTITUTE(SUBSTITUTE(A1,"—","-"),"–","-"))-1),MID(A1,FIND("-",SUBSTITUTE(SUBSTITUTE(A1,"—","-"),"–","-"))+1,99))

+ 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. [SOLVED] AVERAGE of comma separated numbers in a single cell
    By EchoPassenger in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-25-2017, 09:42 AM
  2. How Can I Add Numbers Separated by a Hyphen?
    By pikedrop in forum Excel General
    Replies: 20
    Last Post: 08-25-2017, 03:00 AM
  3. Splitting hyphen-separated data into multiple cells
    By kilowhat in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 12-14-2014, 10:20 PM
  4. [SOLVED] Merging two columuns into one, but having it separated by a hyphen
    By brlcarol99 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-08-2014, 12:20 PM
  5. [SOLVED] Custom Formatting of nos. separated by hyphen
    By naira in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-27-2013, 10:56 PM
  6. [SOLVED] Can you take 2 separate time fields and combine the two separated by a Hyphen in a third?
    By airplanesmoke in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-11-2013, 09:59 AM
  7. [SOLVED] many numbers in one cell separated by hyphen.
    By baju in forum Excel General
    Replies: 7
    Last Post: 02-09-2005, 11:06 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