Formula to convert Hex to Decimal

Hello All,
I have "upgraded" from AppleWorks to iWork Numbers. Yes I've read all about how somethings didn't get ported over, etc. What I need is a formula to convert base 16 to base 10. Any ideas how to do this? I see that numbers has a formula editor so is it possible to make up a conversion formula? Someone done this who would like to share?
Thanks,
Dan

Dan,
Here's a brute-force solution. There may be more elegant ones out there.
DEC formula is: =IF(ISERROR(LOOKUP(MID(A2, 1, 1), LOOKUP TBL :: A$1:A$16, LOOKUP TBL :: B$1:B$16) * 16^3+LOOKUP(MID(A2, 2, 1), LOOKUP TBL :: A$1:A$16, LOOKUP TBL :: B$1:B$16) * 16^2+LOOKUP(MID(A2, 3, 1), LOOKUP TBL :: A$1:A$16, LOOKUP TBL :: B$1:B$16) * 16+LOOKUP(MID(A2, 4, 1), LOOKUP TBL :: A$1:A$16, LOOKUP TBL :: B$1:B$16)),"", LOOKUP(MID(A2, 1, 1), LOOKUP TBL :: A$1:A$16, LOOKUP TBL :: B$1:B$16) * 16^3+LOOKUP(MID(A2, 2, 1), LOOKUP TBL :: A$1:A$16, LOOKUP TBL :: B$1:B$16) * 16^2+LOOKUP(MID(A2, 3, 1), LOOKUP TBL :: A$1:A$16, LOOKUP TBL :: B$1:B$16) * 16+LOOKUP(MID(A2, 4, 1), LOOKUP TBL :: A$1:A$16, LOOKUP TBL :: B$1:B$16))
Be sure to Format Col A of both tables to Text.
Regards,
Jerry

Similar Messages

  • Convert hex to Decimal and keep leading zeros..

    Hi,
    I hope you can help?
    How to convert hex to Decimal and keep leading zeros
    I read 002C, hex, and I want to convert it to 0044 decimal.
    sscanf (MyNum, "%4x", &DecNum); will only give me 44.
    It have been working up till I started to get leading zeros.
    We will always have a 4 digit hex input in a range
    We must have the leading 00 in this case.
    How is this best done?
    Thanks for the help
    Simon
    Solved!
    Go to Solution.

    Hi,
    I don't really understand your problem. Is this stuff what you need ?
    int main (int argc, char *argv[])
    const char MyNum[] = "002C";
    int DecNum;
    sscanf (MyNum, "%4x", &DecNum);
    printf ("%04d", DecNum);
    getchar ();
    return 0;
    "0044" appears on standard output when printf function executes...

  • Converting Hex to Decimal

    hi,
    I want to convert my hex value to decimal. How can I do this? help me pls.
    Suku

    actually...the hardware I'm interacting through com port will retrun data every time in different length. I'm reading that data, byte by byte only. So in that second byte I'm getting the length of the data returned by the hardware. Now for executing my loop that length is required.
    while ((ch = (byte)portInStream.read())!=-1)
    indata[i] = ch;
    String hexString = Integer.toHexString(indata);
    hexDec = Integer.parseInt(hexString);
    strData =strData + hexString;
    i++;
    if(i==15) break;
    in the above code I'm reading 15 bytes from the port. But it may vary...to know the length I want to convert the second byte to int.

  • Java code to convert - Hex to Dec

    I'ld like to convert an Integer or a String from hexadecimal format to a decimal format;
    For example: 30 give 0; 50 give P and so on.
    Can any one help me sending to me a java code that do it please?
    Thanx a lot

    This doesn't convert hex to decimal, but it does convert hex to the character representation, which is what it sounds like you want. At any rate, given "30" it will print "0" and given "50" it will print "P". Also, given "P" it will print "is invalid".
            try
                int in = Integer.parseInt(s, 16);
                Character ch = new Character((char)in); // should validate range here
                System.out.println("In: " + s + ", out: " + ch);
            catch (NumberFormatException e)
                System.out.println("In: " + s + " is invalid.");
            }

  • Conersion of hex to decimal

    Hi,
    I am getting a problem. I am trying to convert hex to decimal but the hex number is pretty huge..
    Can anyone suggest a solution.
    DATA: X00(32) TYPE X VALUE
    '00200120022003200420052006200720082009200A200B200C200D200E200F20'.

    Hi,
    Check this,
    DATA :
      in_buffer  TYPE xstring,
      out_buffer TYPE xstring,
      conv       TYPE REF TO cl_abap_conv_in_ce.
    in_buffer =
    '00200120022003200420052006200720082009200A200B200C200D200E200F20'.
    conv = cl_abap_conv_in_ce=>create(
    encoding = 'UTF-8'
    endian = 'L'
    input = in_buffer
    CALL METHOD conv->read(
    EXPORTING n = 5
    IMPORTING data = out_buffer
    WRITE out_buffer.
    Regards
    Adil

  • Convertion Hex String to 32bits Decimal floating point??

    Hi,
    I would like to know how to convert hexa like: 416b0ac3 in decimal 32bits floating-point. The result of this string is suppose to be 14.690127.
    So i must be able to do:
    From 32-bit Hexadecimal Representation To Decimal Floating-Point
    Thanks for your support
    RiderMerlin

    RiderMerlin
    You can use the typecast function to do this.
    David
    Message Edited by David Crawford on 09-06-2006 03:31 PM
    Attachments:
    Typecast to Single.jpg ‏6 KB

  • Checking and Converting binary, octal, decimal, and hex

    Hi,
    I have a classroom project which will need to validate that data entered in a text is of a certain type with a keyListener, and then convert that value to the other 3 types.
    I know character.isDigit will handle the decimal case, and that I can then use Integer.otString methods to convert to binary, octal, and hex, but what about the other cases?
    Thanks

    OK, this isn't working. If I've already established
    that the string entered into, for example, the
    integer-only textfield is a valid integer, I should be
    able to simply use integer.parseint(s, 2) to convert
    it into binary, right?Not exactly. You should be able to use Integer.parseInt(s, 2) to return the result of converting it from binary representation. You appear to think that this affects whatever "s" refers to, which is not the case. Note also, that method returns an int which is the decimal value in question.
    When you are thinking of int variables, be careful not to think of them as "decimal" or "binary". They are neither. They are just numbers. "Decimal" and "binary" are text representations of numbers, so those concepts can only be applied to strings.
    Integer.parseInt(s, 2);
    txtBin.setText(s);So here you want to assume that the input is a string that represents a number in decimal, and you want to find the string that represents the number in binary. Like this:// convert string in decimal representation to number
    int dec = Integer.parseInt(s);
    // convert int to binary representation as string:
    String binary = Integer.toBinaryString(dec);
    // write that to the text field
    txtBin.setText(binary);You could use a one-liner to do that, but you'll need the "dec" variable to set the other text boxes.
    Rembering why I hate OO...All of what I said there is true in just about all computer languages, OO or otherwise.
    PC²

  • I need a formula to convert a date into an integer (for use in Lookout)

    I have a DATA logger with the following:
    40001 = 4 (2004)
    40002 = 2 (February)
    40003 = 5 (5th)
    40004 = 13 (1:00pm)
    40005 = 12 (12 minutes)
    Lookout requires a date that it understands (eg. January 1, 1900).
    All I need is a basic formula to convert the date and time.
    This formula does not need to be specifically written for Lookout. Just a basic formula that I can do on paper or a calculator.
    I can integrate that formula into the Lookout software myself.

    Hello Smigman,
    First of all, I apologize in advance for not giving you "just the formula." And for the lengthy explanation (had to wait till after work hours), which you are very likely aware of already. I am writing this response in much detail so that it may benefit others.. hopefully And so that we understand the underlying principle involved, which will hopefully help us in building the formula the best way that suits us.
    As you have figured out, the data and time in Lookout is represented as a real number. This real number's integer portion represents days, and the decimal portion denotes time. The integer portion is basically the number of days since 01/01/1900. And the decimal portion is the number of seconds since midnight.
    So, for instance, if you insert the today() Expression in Lookout, you'll get a integer 38022 (which corresponds to today, Feb. 5th, 2004). In other words, today is the 38022nd day since 01/01/1900. Tomorrow, Feb. 6th 2004, will be 38023 and so on.
    The decimal part denotes time. A day has 24*60*60 = 86400 seconds, obviously. So, 1/86400 = 1.15741E-5 roughly represents one second. For instance, 38022.00001157 will give 02/05/2004 00:00:01.
    Coming to the formula now, for Time, first convert it to total seconds from midnight. E.g., 5:15:07pm would be (17*60*60) + (15*60) + 7 = 62107 seconds total since midnight. To get the Lookout's decimal part, divide this by 86400.
    62107/86400 = 0.71883102
    Therefore, 38022.71883102 would now give 02/05/2004 17:15:07. Computing Time is relatively easy.
    For the Date -- which is more complicated-- you could keep track of the total number of days either from 01/01/1900, or better still, a more recent day, like say 12/31/2003, which corresponds to 37986. To this reference you will keep adding 1 for each additional day to get the number for the current day. Note, you will have to accomodate leap years (Feb. 29th of this year, for instance).
    It's very helpful to have the reference day as the last day of the past year. That can be derived by counting the number of days since 01/01/1900 as follows:
    104 years * 365 days = 37960;
    + 1 day for each leap year
    A leap year is a year divisible by 4 (and 400 if the year ends with two zeros). There were 26 leap years from 1900 till 2003.
    So, 37960 + 26 = 37986. 12/31/2003 is thus represented by 37986.
    To get the integer for the Current Date we would first find what day of the year it is. Then add it to the reference day. Feb 5th, is the 36th day of the year. Adding this to 37986, gets us 38022.
    In your case you will have to come up with the correct day of the year using registers 40002 and 40003. Not sure if this helped or confused you more.
    I tried
    Khalid

  • Hex to decimal

    there is any function to convert from hex to decimal and vis versa in PL/SQL?
    Regeards
    eng. Amn2000

    create or replace function sf_sys_hex_to_dec (
    p_hexadecimal in varchar2
    ) return number as
    v_character varchar2(1);
    v_decimal number(10);
    v_number pls_integer;
    v_position pls_integer;
    v_length pls_integer;
    begin
    if p_hexadecimal is null then
    sp_sys_internal_error('Hexadecimal value cannot be null.');
    end if;
    v_length := length(p_hexadecimal);
    if v_length > 8 then
    sp_sys_internal_error('Hexadecimal value too big - maximum allowed is "FFFFFFFF".');
    end if;
    v_position := v_length;
    v_decimal := 0;
    loop
    v_character := substr(p_hexadecimal,v_position,1);
    if v_character = '0' then
    v_number := 0;
    elsif v_character = '1' then
    v_number := 1;
    elsif v_character = '2' then
    v_number := 2;
    elsif v_character = '3' then
    v_number := 3;
    elsif v_character = '4' then
    v_number := 4;
    elsif v_character = '5' then
    v_number := 5;
    elsif v_character = '6' then
    v_number := 6;
    elsif v_character = '7' then
    v_number := 7;
    elsif v_character = '8' then
    v_number := 8;
    elsif v_character = '9' then
    v_number := 9;
    elsif v_character = 'A' then
    v_number := 10;
    elsif v_character = 'B' then
    v_number := 11;
    elsif v_character = 'C' then
    v_number := 12;
    elsif v_character = 'D' then
    v_number := 13;
    elsif v_character = 'E' then
    v_number := 14;
    elsif v_character = 'F' then
    v_number := 15;
    else
    sp_sys_internal_error('Invalid hexadecimal character found.');
    end if;
    v_decimal := v_decimal + v_number * 16 ** (v_length - v_position);
    v_position := v_position - 1;
    if v_position = 0 then
    exit;
    end if;
    end loop;
    return(v_decimal);
    end;
    create or replace function sf_sys_dec_to_hex (
    p_decimal in number
    ) return varchar2 as
    v_hexadecimal varchar2(8);
    v_character varchar2(1);
    v_number pls_integer;
    v_integer pls_integer;
    v_module pls_integer;
    v_first_time boolean;
    begin
    if p_decimal is null then
    sp_sys_internal_error('Decimal value cannot be null.');
    end if;
    if p_decimal > 4294967295 then
    sp_sys_internal_error('Decimal value too big - maximum value is 4294967295.');
    end if;
    v_first_time := true;
    v_number := p_decimal;
    loop
    v_integer := trunc(v_number / 16);
    v_module := mod(v_number,16);
    if v_module = 0 then
    v_character := '0';
    elsif v_module = 1 then
    v_character := '1';
    elsif v_module = 2 then
    v_character := '2';
    elsif v_module = 3 then
    v_character := '3';
    elsif v_module = 4 then
    v_character := '4';
    elsif v_module = 5 then
    v_character := '5';
    elsif v_module = 6 then
    v_character := '6';
    elsif v_module = 7 then
    v_character := '7';
    elsif v_module = 8 then
    v_character := '8';
    elsif v_module = 9 then
    v_character := '9';
    elsif v_module = 10 then
    v_character := 'A';
    elsif v_module = 11 then
    v_character := 'B';
    elsif v_module = 12 then
    v_character := 'C';
    elsif v_module = 13 then
    v_character := 'D';
    elsif v_module = 14 then
    v_character := 'E';
    elsif v_module = 15 then
    v_character := 'F';
    end if;
    if v_first_time = true then
    v_hexadecimal := v_character;
    else
    v_hexadecimal := v_character| |v_hexadecimal;
    end if;
    if v_integer = 0 then
    exit;
    end if;
    v_number := v_integer;
    v_first_time := false;
    end loop;
    return(v_hexadecimal);
    end;
    null

  • Is it possible to create a formula that converts a resource hours into full time units in project server 2010

    Hi
    Is it possible to create a formula that converts a resource available hours into full time equivalent units in project server 2010? Say a resource has 160 available hours for any given month this will translate into 1 FTE for this month. If it is 80 hours
    for that month then it will be 0.5 FTE and so on and so forth.
    Thanks,
    -Maurizio

    Maurizio,
    It's a bit late, but there are two OLAP cubes that can provide you with this information in a pivot table in Project Server 2010.
    "MSP_Portfolio_Analyzer" and "Resource Timephased" contains capacity measures that be used to provide calculated measures when the cube database is generated. You change OLAP cube configuration in "Server Settings -> Database Administration -> OLAP
    Database Management". In either of the aforementioned cubes, use "Calculated Measures" to create two measures:
    Member Name
    MDX Expression
    Available (FTE)
    ([capacity]-[work])/[capacity]
    Work (FTE)
    [Work]/[Capacity]
    These two fields will appear in the pivot table field list as "Values", and when combined with a "Time" column, can give you a picture of FTE usage and availability.
    I prefer the portfolio version since it contains project/assignment data and resource data, letting you see just  how resources are being utilized.
    One thing I have not been able to get around is getting ""Maximum Units" for a resource factored into the measure. A common practice is to allocate more that "100%" to generic resources to represent teams for planning purposes. The OLAP measures will show
    only 0.0 to 1.0 FTE for any resource, even if a resource represents more than one body.
    If you have an SSRS query you could share, I would appreciated it!
    Hope this helps!
    JTC
    JAckson T. Cole, PMP, MCITP

  • Numbers Equivalent of Excel Formula for Converting HH:MM:SS to DD:HH:MM:SS

    I am not sure if this has been asked before.
    What would be the Numbers formula for converting HH:MM:SS to DD:HH:MM:SS?  The Excel formula is entering 396:59:45 into a cell and then in another cell is the following =TEXT(A2,"dd:hh:mm:ss").  The A2 is the example cell.

    There is no formula to actually do the conversion. It is a matter setting the cell format. After that all you need to do is add a simple =<cell> formula to get the value in (i.e. - see my previous post), or a formula to add the two values (=A2+A5). Use Duration rather then Time for the cell formats.
    A duration in Numbers for iOS will not appear 10:16:25:03, it will display as 10d 16h 25m 03s. If it is the actual display punctuation you are trying to change, it may be possible using a combination of a Duration and TEXT functions but would be quite lengthy, convoluted, and more trouble than it is worth.

  • How do I stop Numbers formulas from converting (/) into (÷) for hyperlinks. Ref Ver. 3.5.2

    How do I stop Numbers formulas from converting ( / ) forward slash into (÷) divide for hyperlinks. Ref Ver. 3.5.2
    I am trying to hyperlink to a dropbox url, but the numbers formula is automatically converting / into ÷, preventing the links from working.
    Thank you.

    Hi Merritt.B,
    If you are using HYPERLINK() everything goes inside quotes:
    HYPERLINK("https://discussions.apple.com/thread/6772428","This question")
    quinn

  • Converting character to decimal format

    hi
    i am working on a development where the selection screen has date and time as select options.
    and based on the input i have to concatenate date and time into the format- DD.MM.YYY HH.MM.SS
    there is a value in the table that has a field containing the above value and i have to fetch the data based on this input.
    Now the problem is the field in the table is of format DECIMAL of 16 length.
    i want to know how can i pass this value to the select statement.
    thanks in advance

    Hi ,
    Please check the blog on the below link.
    [Re: Converting char to decimal value format as defined in SU3(User profile);
    This will solve your query.
    Regards
    Abhii......

  • How to convert string to decimal in data association function?

    In a BPM Script component, how in the Data Association can I use an expression to convert an argument from String to Decimal?  I have a Process argument named percentage which is a string.  I need to set the value of a data object called signed to either "Y" or "N" based on the percentage being greater than 0.4.  Something like this:
    (percentage > 0.4) ? "Y" : "N"
    The problem here is that percentage is a string, so must be converted to a decimal value before the compare will work.  I cannot find a function that allows that.  I need something like parseDecimal(percentage), but the Expression Builder does not offer that for a string using a Simple Expression.
    If it cannot be converted, is there another way to do this?

    Guessing you figured this out on your own, but if you wanted to use a Script activity one way to do what you want is when you're creating your data associations drag the "Expression" icon in the middle and double click the icon in the middle you just added:
    Get out of the Simple expression mode and into the XPath expression mode by clicking the dropdown in the upper left corner -> click "XPath Exp".
    In the Functions dropdown on the right, click "Conversion Functions" -> click "number" and then insert it into the expression.
    In the Variables list, select your string variable and insert it into the number function so that it looks something like this:  number(bpmn:getDataObject('myStringVariable'))
    Click OK
    Click your expression icon in the middle and drag it over your decimal variable.
    To have it evaluate and return a Boolean expression in your Script activity, add a Boolean process variable and add an XPath expression as described above except have the logic be this:  number(bpmn:getDataObject('myStringVariable')) > .4  (the "greater than" shown above is added to the expression by clicking "Logical Functions" from the functions dropdown).  Click OK and drag your expression icon over your Boolean variable.
    Dan

  • Converting hex to dec

    Hi everybody,
    I want to join this two numbers and convert them from hex to dec. I have tried using joint and conversion but I still couldn't work it. In the following screen shot I took it suppose to be 3E8 in hex which equals to 1000 in dec. I need suggestion from you how to approach this.
    Thanks
    Solved!
    Go to Solution.

    SOBGA wrote:
    As I was reading all the answers about converting Hex to Dec,I found out that many of you are making it so complicated.To make it easier for a learner or beginner,this is what it takes:
    Open a blank VI
    Click on numeric control
    Right click on the same numeric control
    Scroll down to "Representation"
    Click on "U8"
    Go to numeric indicator and repeat step 4 and 5
    Then right click again on numeric control
    Scroll down to "Properties" and click
    Click on "Data entry",if necessary,change the minimum and maximum
    Pass to "Display format" 
    Click on "Hexadecimal" then you are done.The rest is to go on the block diagram to wire the numeric control to the numeric indicator and it works.
    You can do the same process reverse for dec to hex.But you must know that what we did for "numeric control" on (Hex to Dec) will be done to "numeric indicator" on (Dec to Hex).This same process can apply to octal and binary without the use of complicated array,string while loop and so on...
    I'm a beginner in Labview and I understand that you need to explain more to understand better.
    If you really read all of the comments, you would see that Altenbach already stated this (saying it is just a cosmetic property for the indicator).
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

Maybe you are looking for

  • Order related billing

    27.01.2011 Hi friends, I am trying to create order related billing. The material is a service, but i need to have a delivery created in the background. I have created an order and the delivery is created automatically. But when i am trying to create

  • Time stamps not linear

    Hi, I have a DAQ USB-6251 driven by labview. The time stamps on the text file have backward and forward jumps in them.  See attached for picture. They increase linearly for about 12000 samples, then jump backwards about a 3 sec, linearly increase for

  • LC Process in SAP

    Dear All, any one can tell me in detail how LC process can run in SAP, like i know a little that PO should be IV based not GR-IV based. regards, qsm sap

  • Standard OM infotype 1240

    Hi everyone: I have come across a rather odd situation in Org Management. Up until now, I was under the impression that all standard SAP infotypes were, like infotypes 1000 (Object) & 1001 (Relationships), comprised of many components (see attached I

  • Heterogeneous Services & SQL Server

    I understand that connecting an Oracle database to a SQL Server database can be done using the Heterogeneous Services which will set up a Transparent Gateway to the SQL Server data. Where can I get the agent needed to connect the two though? Are ther