Simple Binary Math - Reset to Zero

SAC_CCNP

New Member
Joined
Jun 16, 2015
Messages
4
I am creating a subnet calculator. Binary math. My calculation involves block sizes of 2 to x power. Block size of 2,4,8…128,256. I am doing my work in a column. When the value reaches 256, I need to reset it to 0. The current cell contains previous cell value plus the (absolute value) block size. I.E. =E17+$E$2 (=240+16).
What I need is a formula that if the value = 256 to reset to 0.

Thanks in advance for your assistance.
 
Last edited:

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
One more simple thing that will assist me in creating some scripting; I need something (I think an array but I don’t know), that produces a result based on the output.

If the value is 128 the result is 127
If the value is 192 the result is 63
Etc.

(just need the formula)

Again, thanks in advance.
 
Upvote 0
One more simple thing that will assist me in creating some scripting; I need something (I think an array but I don’t know), that produces a result based on the output.

If the value is 128 the result is 127
If the value is 192 the result is 63
Etc.
I do not understand what you are describing that you need to do. Where is the mapping between the numbers you show? How are the number to be input into the program? After the mapping is done, where are the values to be stored at and how do you plan to make use of them? The more details you can provide, the faster you will get an answer.
 
Upvote 0
I do not understand what you are describing that you need to do. Where is the mapping between the numbers you show? How are the number to be input into the program? After the mapping is done, where are the values to be stored at and how do you plan to make use of them? The more details you can provide, the faster you will get an answer.


Thanks Rick, your previous solution provided me exactly the result that I needed.

I had looked at the problem incorrectly (and subsequently described in error).

What I need is a cell that takes my “block size” cell value [A] (2,4,8,16…256) and in the cell with the formula produce the corresponding value (one of the octets of a subnet mask)

Input Result
[A]
16 240
32 224
64 192
[…]

I can complete the work once I see the formula.

Network guy here, not a programmer, formula guy.

Thanks again, very much appreciated
 
Last edited:
Upvote 0

Forum statistics

Threads
1,222,017
Messages
6,163,411
Members
451,835
Latest member
kristianb63

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