Using nested function with SUM & ROUND

Burrgogi

Active Member
Joined
Nov 3, 2005
Messages
495
Office Version
  1. 2010
Platform
  1. Windows
In one of the cells in my worksheet, I have entered the following formula:
=CONCATENATE("Qtr 1 Average: $"&SUM(B2+C2+D2)/3)&" ("&SUM(B3+C3+D3)&" gal used)"

which gives me the following:
Qtr 1 Average: $53.9066666666667 (64.39 gal used)

I'd like the number that follows the word "average" to be rounded off to 2 digits so that the result reads:
Qtr 1 Average: $53.91 (64.39 gal used)

I know there is such a thing as the ROUND function, but I can't figure out how to incorporate it into my current formula. If anyone has some alternative solutions, I'd be curious about that as well. Also, is there a way to bold just the average number instead of bolding the entire cell?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Try this out!
=CONCATENATE("Qtr 1 Average: $"&ROUND(SUM(B2+C2+D2)/3),2)&" ("&SUM(B3+C3+D3)&" gal used)"
 
Upvote 0
There reason to use SUM in this case, in the first place. Simply write:

=CONCATENATE("Qtr 1 Average: $"&ROUND((B2+C2+D2)/3,2)&" ("&ROUND(B3+C3+D3,2)&" gal used)"

Or you might consider the following for large sets of data:

=CONCATENATE("Qtr 1 Average: $"&ROUND(SUM(B2:D2)/3,2)&" ("&ROUND(SUM(B3:D3),2)&" gal used)"


I suggest that you explicitly round even the simple sum (B3+C3+D3) because Excel arithmetic is notorious for producing "binary arithmetic anomalies". That is, we might expect 64.39 based on decimal arithmetic, but Excel returns 64.3900000000001 or 64.3899999999999 because more decimal fractions cannot be represented in 64-bit binary floating-point exactly.
 
Upvote 0
there are also other functions - DOLLAR and TEXT - that may suffice
Code:
="Qtr 1 Average: "&DOLLAR(AVERAGE(B2:D2),2)&" ("&TEXT(SUM(B3:D3),"#,##0.00")&" gal used)"
 
Upvote 0
Or you might consider the following for large sets of data:
=CONCATENATE("Qtr 1 Average: $"&ROUND(SUM(B2:D2)/3,2)&" ("&ROUND(SUM(B3:D3),2)&" gal used)"

I should have written:

=CONCATENATE("Qtr 1 Average: $"&ROUND(AVERAGE(B2:D2),2)&" ("&ROUND(SUM(B3:D3),2)&" gal used)"
 
Upvote 0
there are also other functions - DOLLAR and TEXT - that may suffice
Code:
="Qtr 1 Average: "&DOLLAR(AVERAGE(B2:D2),2)&" ("&TEXT(SUM(B3:D3),"#,##0.00")&" gal used)"

Great combination there Fazza - I completely forgot about using the AVERAGE function and using that with the DOLLAR function did the trick. Thank you!

I should have written:=CONCATENATE("Qtr 1 Average: $"&ROUND(AVERAGE(B2:D2),2)&" ("&ROUND(SUM(B3:D3),2)&" gal used)"

Thank you joeu2004! Your formula worked as well. The worksheet that I created is a very simple one in that it tracks how much I've spent on car fuel each month (and gallon consumption). in the future, if I ever have to work with a larger data set, I'll keep your post in mind. By the way, Excel tells me you're missing a closing parenthesis at the end of your formula. The tail end of it should read:
Code:
&" gal used)")

You guys are great. In fact, all the people that have helped me in the past are so knowledgeable and kind that I can't thank you enough.
 
Last edited:
Upvote 0
By the way, Excel tells me you're missing a closing parenthesis at the end of your formula.

I had meant to omit the leading "CONCATENATE(", which is redundant. You use "&" for concatenation.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top