Round & Integer Function with Controlled Total

farisi

New Member
Joined
May 25, 2023
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hi,
I have a data like this for each Province and City, and simply convert the decimal "Value" to Integer "Value_Integer" using simple round & integer function.

ask.png


However, as you can see, the total using column "Value" in Province A, is different from the Total using "Value_Integer" because of that round function.
What I want is if :
1. Total between original value and integer value for that Province is the same (like Province B) , do not do anything
2. Total between original value and integer value for that Province is different (like Province B), column "Value_Integer" will change a little bit, with maximum difference with original value is only 1, so it match with the total from decimal value.

Any help will be very appreciated.
Thank you so much.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Book1
DEFG
14.29942020
24.2544
311.44711
411.612
Sheet3
Cell Formulas
RangeFormula
F1:G1F1=SUM(D1:D3)


column E instead of using round, you may use custom number format = 0 , but when 11.6 will become 12.

1685682428087.png
 
Upvote 0
Hello, thank you for your comment.

I understand your method, but its still not the one that I want.
Because what I want is truly change the value to integer value but keep the total consistent (not just as the display), since that column will be changed to integer later on (cant accept decimal value )

Thank you
 
Upvote 0
Is this what you mean?

23 06 02.xlsm
ABCDE
1
2A4.299420
3A4.2544
4A11.44712
5B3.255320
6B4.6555
7B2.1552
8B9.93510
Adjust
Cell Formulas
RangeFormula
D2:D8D2=IF(A2=A3,ROUND(C2,0),LOOKUP(9^9,E$1:E2)-SUMIF(A$1:A1,A2,D$1:D1))
E2E2=SUM(C2:C4)
E5E5=SUM(C5:C8)
 
Upvote 0
Thank you, Almost like that.
But sometimes if data is hundred or thousand the total difference between total integer and total decimal can reach 5 or something.
So with your formula, that difference will be all applied to last data for each subgroup, right?
 
Upvote 0

Forum statistics

Threads
1,215,133
Messages
6,123,235
Members
449,092
Latest member
SCleaveland

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