ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Any way to add hex numbers? (https://www.excelbanter.com/excel-programming/420670-any-way-add-hex-numbers.html)

Fan924

Any way to add hex numbers?
 
I am trying to optimize my checksum routine without using a macro.
Using formulas only if possible. I add up a column of hex numbers and
generates a 4 digit hex checksum. To do this, I had to generate a
decimal number in column D and then add column D. I want to remove
column D from the worksheet. Any way to add hex numbers?

checksum=RIGHT(DEC2HEX(SUM(D1:D4098)),4)

C D
--- ---
02 2
1F 31
4E 78
02 2
1F 31
3A 58
02 2
02 2
72 114
12 18
1E 30
53 83
02 2

I tried variations of this which does not work
(SUM(HEX2DEC(C1):HEX2DEC(C4098))

Fan924

Any way to add hex numbers?
 
Never mind. I found this in a Macro I did a few years ago and forgot.
It works. Sorry

ActiveCell.FormulaR1C1 = "=RIGHT(DEC2HEX(SUM(R[0]C[-4]:R[4097]C[-4])),
4)"


All times are GMT +1. The time now is 10:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com