Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 238
Default Formatting formula output

Cell has the following formula
=DEC2HEX((I28-H28)/40)

The output is a hecidecimal A. I would like it to be 0A. Hex numbers
vary from 00 to FFand I neee help wiith the formatting.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Formatting formula output

As long as your hexadecimal values will only be 1 or 2 hex digits long...

=RIGHT("0"&DEC2HEX((I28-H28)/40),2)

--
Rick (MVP - Excel)


"Fan924" wrote in message
...
Cell has the following formula
=DEC2HEX((I28-H28)/40)

The output is a hecidecimal A. I would like it to be 0A. Hex numbers
vary from 00 to FFand I neee help wiith the formatting.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Formatting formula output

On Sat, 7 Feb 2009 17:16:12 -0800 (PST), Fan924 wrote:

Cell has the following formula
=DEC2HEX((I28-H28)/40)

The output is a hecidecimal A. I would like it to be 0A. Hex numbers
vary from 00 to FFand I neee help wiith the formatting.


Did you check HELP for the function? That is what the optional [places]
argument is for.

=DEC2HEX((I28-H28)/40,2)

--ron
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Formatting formula output

He-he... obviously I didn't. <g

--
Rick (MVP - Excel)


"Ron Rosenfeld" wrote in message
...
On Sat, 7 Feb 2009 17:16:12 -0800 (PST), Fan924 wrote:

Cell has the following formula
=DEC2HEX((I28-H28)/40)

The output is a hecidecimal A. I would like it to be 0A. Hex numbers
vary from 00 to FFand I neee help wiith the formatting.


Did you check HELP for the function? That is what the optional [places]
argument is for.

=DEC2HEX((I28-H28)/40,2)

--ron


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Formatting formula output

On Sun, 8 Feb 2009 09:53:08 -0500, "Rick Rothstein"
wrote:

He-he... obviously I didn't. <g


Sorry. I had addressed my comment to the OP. It looks as if it is threaded
that way on my news reader (Agent). Maybe it looks different on yours?
--ron


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Formatting formula output

No apology necessary, you didn't do anything wrong. I know you addressed
your comment to the OP... my comment wasn't responding to your statement as
if you had addressed it to me... I was just noting that obviously I didn't
look up the function in the help files either (obvious from the fact that I
posted a more involved "RIGHT function with concatenation" solution that
didn't use the available optional argument... I thought that was kind of
funny. I don't have any occasion to use Hex/Decimal conversions, so I just
went with what the OP posted (assuming there was no built-in way of
specifying digits because he didn't use any) and posted my solution without
looking the function up for myself. I'm glad you came along and showed the
OP the correct way to solve his problem.

--
Rick (MVP - Excel)


"Ron Rosenfeld" wrote in message
...
On Sun, 8 Feb 2009 09:53:08 -0500, "Rick Rothstein"
wrote:

He-he... obviously I didn't. <g


Sorry. I had addressed my comment to the OP. It looks as if it is
threaded
that way on my news reader (Agent). Maybe it looks different on yours?
--ron


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Formatting formula output

On Sun, 8 Feb 2009 12:21:00 -0500, "Rick Rothstein"
wrote:

No apology necessary, you didn't do anything wrong. I know you addressed
your comment to the OP... my comment wasn't responding to your statement as
if you had addressed it to me... I was just noting that obviously I didn't
look up the function in the help files either (obvious from the fact that I
posted a more involved "RIGHT function with concatenation" solution that
didn't use the available optional argument... I thought that was kind of
funny. I don't have any occasion to use Hex/Decimal conversions, so I just
went with what the OP posted (assuming there was no built-in way of
specifying digits because he didn't use any) and posted my solution without
looking the function up for myself. I'm glad you came along and showed the
OP the correct way to solve his problem.

--
Rick (MVP - Excel)


Ah. Now I see. When I posted my comment, I had not seen yours. And even
after, I didn't look at yours more closely. I just glanced at it and, seeing
the ...,2), I just quickly jumped to the conclusion that the "2" was the
optional argument for the dec2hex function, and completely missed that it was
the numchars argument for the right function.

Just goes to show how my bias affected what I saw.
--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting Output Range in Combo Box V2 Excel Discussion (Misc queries) 2 February 23rd 09 01:10 PM
Formatting text output within formulas Colin Hayes Excel Worksheet Functions 1 January 16th 09 02:04 PM
conditional formatting w/ color as input vs output tom Excel Worksheet Functions 3 December 13th 06 02:34 AM
Pivot Output formatting. BEE Excel Programming 3 December 16th 03 02:56 PM
Formatting equation output David Thurston Excel Programming 1 December 12th 03 08:04 PM


All times are GMT +1. The time now is 12:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"