+ Reply to Thread
Results 1 to 11 of 11

Cell format changes depending on formula.

  1. #1
    Registered User
    Join Date
    06-26-2013
    Location
    Powell, near Knoxville, TN
    MS-Off Ver
    Office 2010
    Posts
    26

    Question Cell format changes depending on formula.

    Hi,

    I'm Russ, new to the forum. Looked for this in FAQ but didn't find the answer.

    My formula works fine, but I need the first number of the answer displayed with only two decimal places. The formula averages a set of numbers, then adds " of " and a cell reference.

    I want the answer displayed as 2.43 of 3. Here is the formula.

    =IF(AVERAGE(W12:W123)>0,(AVERAGE(W12:W123))&" of "& Z9,"") it works perfectly but displays 2.42857142857143 of 3.

    The cell is formatted to NUMBER with two decimal places. . Changing the format has no effect, but changing the formula does.

    If I use =IF(AVERAGE(W12:W123)>0,(AVERAGE(W12:W123)) or =AVERAGE(W12:W123) the result is 2.43. When I add the next portion, &" of "& Z9,"") it changes to 2.42857142857143.

    I've tried reformatting cells and nothing changes. This is the only cell I'm having problems with. The worksheet seems to be working fine.

    I'm greatfull for any advice you can offer.

    Thanks,

    Russ

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,792

    Re: Cell format changes depending on formula.

    What happends if you change your formula to

    Please Login or Register  to view this content.
    Alf

  3. #3
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,636

    Re: Cell format changes depending on formula.

    =IF(AVERAGE(W12:W123)>0,(AVERAGE(W12:W123))&" of "& Z9,"") returns a text string as you have used concatenation and you cannot round it this way

    Try
    Please Login or Register  to view this content.

  4. #4
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Cell format changes depending on formula.

    Seeing that the answer is going to be a text value this might help.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This means that if the average of the range W12:W123 is greater than 0, take the value of the average of W12 to w123, treat it as text with the format of "000.00" space of space the value in Z9.
    Last edited by newdoverman; 07-18-2013 at 02:46 PM.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  5. #5
    Registered User
    Join Date
    06-26-2013
    Location
    Powell, near Knoxville, TN
    MS-Off Ver
    Office 2010
    Posts
    26

    Re: Cell format changes depending on formula.

    thanks Alf. This returned a Value error.

    Russ

  6. #6
    Registered User
    Join Date
    06-26-2013
    Location
    Powell, near Knoxville, TN
    MS-Off Ver
    Office 2010
    Posts
    26

    Re: Cell format changes depending on formula.

    Thanks newdoverman. This worked perfectly! Thank you so much. I really appreciate it.

    russ

  7. #7
    Registered User
    Join Date
    06-26-2013
    Location
    Powell, near Knoxville, TN
    MS-Off Ver
    Office 2010
    Posts
    26

    Re: Cell format changes depending on formula.

    Thanks Pepe Le Mokko,

    This worked perfectly too! I appreciate your help very much.

    Russ

  8. #8
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,636

    Re: Cell format changes depending on formula.

    Wrong thread for this post

  9. #9
    Registered User
    Join Date
    06-26-2013
    Location
    Powell, near Knoxville, TN
    MS-Off Ver
    Office 2010
    Posts
    26

    Re: Cell format changes depending on formula.

    How do I marked this thread as solved?
    Russ

  10. #10
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Cell format changes depending on formula.

    You're welcome. Glad to help. Thanks for the feedback.

  11. #11
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,636

    Re: Cell format changes depending on formula.

    Quote Originally Posted by Russ Fuquay View Post
    How do I marked this thread as solved?
    Russ
    I think it's in the thread tools, just above your OP

+ 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. Dual cell format depending on input data
    By Timeshock in forum Excel General
    Replies: 6
    Last Post: 03-10-2013, 10:03 AM
  2. Replies: 14
    Last Post: 11-14-2012, 11:24 AM
  3. Format Cell Font (Type & Colour) depending on value
    By GrazP in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-19-2010, 08:10 PM
  4. Replies: 1
    Last Post: 05-03-2006, 11:15 PM
  5. Replies: 1
    Last Post: 05-12-2005, 08:06 PM

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