+ Reply to Thread
Results 1 to 4 of 4

Need to know how to make functions/formula work in LOOKUP...

  1. #1
    Registered User
    Join Date
    08-27-2006
    Posts
    2

    Need to know how to make functions/formula work in LOOKUP...

    Alright, I am making a decimal/binary/hex/octal convertor.
    I have cell E3 set as a drop down box where you can pick from Decimal, Hexadecimal, Binary, and Octal. This is the type of number you will enter.
    And then I have Cell E4 where you enter your own number.

    Then I am going to have places for the results. I am trying to use LOOKUP to see what E3 is and then convert whatever the number in E4 is to the other types. So here is the code I am using to convert it to octal:

    =LOOKUP(E3, {"Decimal","=DEC2OCT(E4)";"Hexadecimal","=HEX2OCT(E4)";"Binary","=BIN2OCT(E4)";"Octal","E4"})

    The problem is that I can only get it to show =DEC2OCT(E4),E4,etc not the actual answer to it or the cell....is there anyway I can get it to show the answer?

  2. #2
    Valued Forum Contributor Excelenator's Avatar
    Join Date
    07-25-2006
    Location
    Wantagh, NY
    Posts
    333
    You don't need LOOKUP you need IF statements or Select Case

    With if statements you would cycle through each result like so

    Please Login or Register  to view this content.
    or with Select Case it would look like this

    Please Login or Register  to view this content.
    Quote Originally Posted by chrisophos
    Alright, I am making a decimal/binary/hex/octal convertor.
    I have cell E3 set as a drop down box where you can pick from Decimal, Hexadecimal, Binary, and Octal. This is the type of number you will enter.
    And then I have Cell E4 where you enter your own number.

    Then I am going to have places for the results. I am trying to use LOOKUP to see what E3 is and then convert whatever the number in E4 is to the other types. So here is the code I am using to convert it to octal:

    =LOOKUP(E3, {"Decimal","=DEC2OCT(E4)";"Hexadecimal","=HEX2OCT(E4)";"Binary","=BIN2OCT(E4)";"Octal","E4"})

    The problem is that I can only get it to show =DEC2OCT(E4),E4,etc not the actual answer to it or the cell....is there anyway I can get it to show the answer?
    ---------------------------------------------------
    ONLY APPLIES TO VBA RESPONSES WHERE APPROPRIATE
    To insert code into the VBE (Visual Basic Editor)
    1. Copy the code.
    2. Open workbook to paste code into.
    3. Right click any worksheet tab, select View Code
    4. VBE (Visual Basic Editor) opens to that sheets object
    5. You may change to another sheets object or the This Workbook object by double clicking it in the Project window
    6. In the blank space below the word "General" paste the copied code.

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Try this formula

    =CHOOSE(MATCH(E3,{"Decimal","Hexadecimal","Binary","Octal"},0),DEC2OCT(E4),HEX2OCT(E4),BIN2OCT(E4),E4)

  4. #4
    Registered User
    Join Date
    08-27-2006
    Posts
    2
    Wow, thanks both of you. (Altho I didn't know where I was supposed to enter the first one) I got the second to work.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1