PC Review


Reply
Thread Tools Rate Thread

changing decimal places according to formula result

 
 
Valeria
Guest
Posts: n/a
 
      11th Sep 2009
Dear experts,
I have a table which looks up values from a database; this table is linked
to a cell where I can select what I want to see in the table.
Now, sometimes the values I want to see need to be in a 2 decimal format
(ex. 2.43) and sometimes they need to have no decimals at all (ex. 25000). It
really all depends on their magnitude - when <10 then I need to have 2
decimals, if > 10 then no decimal is needed.
Is there a way to do this in Excel 2003?
Many thanks for your help!
Kind regards
--
Valeria
 
Reply With Quote
 
 
 
 
Pete_UK
Guest
Posts: n/a
 
      11th Sep 2009
Suppose your number is in A1. Try this in B1:

=TEXT(A1,IF(A1>10,"0",0.00"))

This will return a text value, and it will round the number, so if
your number is 10.6 it will show 11.

If you don't want this, then here's an alternative:

=IF(A1>10,INT(A1),A1)

Format the cell as General. This time 10.6 will show as 10, and 9.95
will show as 9.95.

If you want this to happen to your cell which contains the VLOOKUP
formula, then just substitute your formula for A1 in the above.

Hope this helps.

Pete



On Sep 11, 10:29*am, Valeria <Vale...@discussions.microsoft.com>
wrote:
> Dear experts,
> I have a table which looks up values from a database; this table is linked
> to a cell where I can select what I want to see in the table.
> Now, sometimes the values I want to see need to be in a 2 decimal format
> (ex. 2.43) and sometimes they need to have no decimals at all (ex. 25000).. It
> really all depends on their magnitude - when <10 then I need to have 2
> decimals, if > 10 then no decimal is needed.
> Is there a way to do this in Excel 2003?
> Many thanks for your help!
> Kind regards
> --
> Valeria


 
Reply With Quote
 
David Biddulph
Guest
Posts: n/a
 
      11th Sep 2009
Format Cell/ Number/ Custom
[<10]0.00; 0

You talked about <10 and >10, but I guessed that you meant >=10.
--
David Biddulph

"Valeria" <(E-Mail Removed)> wrote in message
news:0EE3BF8F-C90E-4957-8DBA-(E-Mail Removed)...
> Dear experts,
> I have a table which looks up values from a database; this table is linked
> to a cell where I can select what I want to see in the table.
> Now, sometimes the values I want to see need to be in a 2 decimal format
> (ex. 2.43) and sometimes they need to have no decimals at all (ex. 25000).
> It
> really all depends on their magnitude - when <10 then I need to have 2
> decimals, if > 10 then no decimal is needed.
> Is there a way to do this in Excel 2003?
> Many thanks for your help!
> Kind regards
> --
> Valeria



 
Reply With Quote
 
MS-Exl-Learner
Guest
Posts: n/a
 
      11th Sep 2009
Try this formula

=IF(A1="","",IF(A1=T(A1),"",IF(A1<10,TEXT(A1,"#.##"),TEXT(A1,"#######"))))

Type your value in a1 cell. for applying the same formula to your cell
change the reference a1 to your cell.

If this post helps, Click yes...

--------------------
(MS-Exl-Learner)
--------------------



"Valeria" wrote:

> Dear experts,
> I have a table which looks up values from a database; this table is linked
> to a cell where I can select what I want to see in the table.
> Now, sometimes the values I want to see need to be in a 2 decimal format
> (ex. 2.43) and sometimes they need to have no decimals at all (ex. 25000). It
> really all depends on their magnitude - when <10 then I need to have 2
> decimals, if > 10 then no decimal is needed.
> Is there a way to do this in Excel 2003?
> Many thanks for your help!
> Kind regards
> --
> Valeria

 
Reply With Quote
 
David Biddulph
Guest
Posts: n/a
 
      11th Sep 2009
You may want to think a bit further.
As -20 is less than 10, do you want that to show 2 decimals?
If what you intended was 2 decimals for numbers > -10 and < 10, you may want
[<=-10]-0;[<10]0.00; 0
--
David Biddulph

"David Biddulph" <groups [at] biddulph.org.uk> wrote in message
news:4aaa1e6f$(E-Mail Removed)...
> Format Cell/ Number/ Custom
> [<10]0.00; 0
>
> You talked about <10 and >10, but I guessed that you meant >=10.
> --
> David Biddulph
>
> "Valeria" <(E-Mail Removed)> wrote in message
> news:0EE3BF8F-C90E-4957-8DBA-(E-Mail Removed)...
>> Dear experts,
>> I have a table which looks up values from a database; this table is
>> linked
>> to a cell where I can select what I want to see in the table.
>> Now, sometimes the values I want to see need to be in a 2 decimal format
>> (ex. 2.43) and sometimes they need to have no decimals at all (ex.
>> 25000). It
>> really all depends on their magnitude - when <10 then I need to have 2
>> decimals, if > 10 then no decimal is needed.
>> Is there a way to do this in Excel 2003?
>> Many thanks for your help!
>> Kind regards
>> --
>> Valeria

>
>



 
Reply With Quote
 
Valeria
Guest
Posts: n/a
 
      11th Sep 2009
This works really great and is really easy to do!!! Many thanks.
Kind regards
--
Valeria


"David Biddulph" wrote:

> Format Cell/ Number/ Custom
> [<10]0.00; 0
>
> You talked about <10 and >10, but I guessed that you meant >=10.
> --
> David Biddulph
>
> "Valeria" <(E-Mail Removed)> wrote in message
> news:0EE3BF8F-C90E-4957-8DBA-(E-Mail Removed)...
> > Dear experts,
> > I have a table which looks up values from a database; this table is linked
> > to a cell where I can select what I want to see in the table.
> > Now, sometimes the values I want to see need to be in a 2 decimal format
> > (ex. 2.43) and sometimes they need to have no decimals at all (ex. 25000).
> > It
> > really all depends on their magnitude - when <10 then I need to have 2
> > decimals, if > 10 then no decimal is needed.
> > Is there a way to do this in Excel 2003?
> > Many thanks for your help!
> > Kind regards
> > --
> > Valeria

>
>
>

 
Reply With Quote
 
gwen
Guest
Posts: n/a
 
      11th Sep 2009
This is a great help to me. However I tried to modify it:

[<=-10]-0;[<10]0.00; [<100]0.0; 0

And Excel won't accept the number format. Did I do something wrong?


"David Biddulph" wrote:

> You may want to think a bit further.
> As -20 is less than 10, do you want that to show 2 decimals?
> If what you intended was 2 decimals for numbers > -10 and < 10, you may want
> [<=-10]-0;[<10]0.00; 0
> --
> David Biddulph
>
> "David Biddulph" <groups [at] biddulph.org.uk> wrote in message
> news:4aaa1e6f$(E-Mail Removed)...
> > Format Cell/ Number/ Custom
> > [<10]0.00; 0
> >
> > You talked about <10 and >10, but I guessed that you meant >=10.
> > --
> > David Biddulph
> >
> > "Valeria" <(E-Mail Removed)> wrote in message
> > news:0EE3BF8F-C90E-4957-8DBA-(E-Mail Removed)...
> >> Dear experts,
> >> I have a table which looks up values from a database; this table is
> >> linked
> >> to a cell where I can select what I want to see in the table.
> >> Now, sometimes the values I want to see need to be in a 2 decimal format
> >> (ex. 2.43) and sometimes they need to have no decimals at all (ex.
> >> 25000). It
> >> really all depends on their magnitude - when <10 then I need to have 2
> >> decimals, if > 10 then no decimal is needed.
> >> Is there a way to do this in Excel 2003?
> >> Many thanks for your help!
> >> Kind regards
> >> --
> >> Valeria

> >
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Subtracting two 2-decimal place numbers gives result 13-decimal places? tsdutcher@earthlink.net Microsoft Excel Worksheet Functions 5 12th Mar 2007 10:38 PM
Incorrect formula result/ decimal places =?Utf-8?B?UXVhbnR1bUxlYXA=?= Microsoft Access Queries 4 20th Jul 2006 09:35 AM
RE-POST: Incorrect formula result/ decimal places =?Utf-8?B?UXVhbnR1bUxlYXA=?= Microsoft Access Queries 4 9th May 2006 01:32 PM
round the result of an expression to two decimal places =?Utf-8?B?TGluZHk=?= Microsoft Access Reports 1 19th May 2005 03:03 AM
limiting decimal places in query result =?Utf-8?B?TWF0dGhldw==?= Microsoft Frontpage 3 7th Jun 2004 06:19 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:23 PM.