Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
FGM FGM is offline
external usenet poster
 
Posts: 35
Default Excel fraction not a date

Windows 2000, Excel 2003
How do you get excel to use a fraction as a fraction and not a date? I am
using a function that returns a fraction as a string. I then copy it and
paste it in a new cell as value.. I have tried formating the cell as a
decimal, as a fraction, it just keeps it as text or views it as a date....
any help would be appreciated.
Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Excel fraction not a date

It does not matter if its VBA or on the worksheet:

Sub frac()
Selection.Formula = "= 1/4"
Selection.Value = Selection.Value
End Sub


The space makes it a fraction and not a date. Format the cell to carrry the
proper number of digits in the numerator and denominator.
--
Gary''s Student - gsnu200724


"FGM" wrote:

Windows 2000, Excel 2003
How do you get excel to use a fraction as a fraction and not a date? I am
using a function that returns a fraction as a string. I then copy it and
paste it in a new cell as value.. I have tried formating the cell as a
decimal, as a fraction, it just keeps it as text or views it as a date....
any help would be appreciated.
Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Excel fraction not a date

I think you would need to evaluate the fraction as a decimal and place that
in a cell. then format the cell as fraction.

It is unclear whether you are doing the copying with code or manually. If
manual, I can select the fraction in the formula bar and do ctrl+V, go to the
new cell and select it. Go to the formula bar and enter = then ctrl+C
and hit enter. Format the cell as fraction.

--
Regards,
Tom Ogilvy


"FGM" wrote:

Windows 2000, Excel 2003
How do you get excel to use a fraction as a fraction and not a date? I am
using a function that returns a fraction as a string. I then copy it and
paste it in a new cell as value.. I have tried formating the cell as a
decimal, as a fraction, it just keeps it as text or views it as a date....
any help would be appreciated.
Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Excel fraction not a date

The equal sign makes it a fraction. The below works fine for me.

Sub frac()
Selection.Formula = "=1/4"
Selection.Value = Selection.Value
End Sub

as does manual entry
=1/4

This could be affected by the settings in the transition tab of
tools=options.

--
Regards,
Tom Ogilvy


"Gary''s Student" wrote:

It does not matter if its VBA or on the worksheet:

Sub frac()
Selection.Formula = "= 1/4"
Selection.Value = Selection.Value
End Sub


The space makes it a fraction and not a date. Format the cell to carrry the
proper number of digits in the numerator and denominator.
--
Gary''s Student - gsnu200724


"FGM" wrote:

Windows 2000, Excel 2003
How do you get excel to use a fraction as a fraction and not a date? I am
using a function that returns a fraction as a string. I then copy it and
paste it in a new cell as value.. I have tried formating the cell as a
decimal, as a fraction, it just keeps it as text or views it as a date....
any help would be appreciated.
Thanks.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,344
Default Excel fraction not a date

Hi,

Here's one way - select the range and choose the command Format, Cells,
Number tab, Fraction and pick a format of your choice.

Then enter the number as fractions.
--
Cheers,
Shane Devenshire


"FGM" wrote:

Windows 2000, Excel 2003
How do you get excel to use a fraction as a fraction and not a date? I am
using a function that returns a fraction as a string. I then copy it and
paste it in a new cell as value.. I have tried formating the cell as a
decimal, as a fraction, it just keeps it as text or views it as a date....
any help would be appreciated.
Thanks.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Excel fraction not a date

Thank you
--
Gary''s Student - gsnu200724


"Tom Ogilvy" wrote:

The equal sign makes it a fraction. The below works fine for me.

Sub frac()
Selection.Formula = "=1/4"
Selection.Value = Selection.Value
End Sub

as does manual entry
=1/4

This could be affected by the settings in the transition tab of
tools=options.

--
Regards,
Tom Ogilvy


"Gary''s Student" wrote:

It does not matter if its VBA or on the worksheet:

Sub frac()
Selection.Formula = "= 1/4"
Selection.Value = Selection.Value
End Sub


The space makes it a fraction and not a date. Format the cell to carrry the
proper number of digits in the numerator and denominator.
--
Gary''s Student - gsnu200724


"FGM" wrote:

Windows 2000, Excel 2003
How do you get excel to use a fraction as a fraction and not a date? I am
using a function that returns a fraction as a string. I then copy it and
paste it in a new cell as value.. I have tried formating the cell as a
decimal, as a fraction, it just keeps it as text or views it as a date....
any help would be appreciated.
Thanks.

  #7   Report Post  
Posted to microsoft.public.excel.programming
FGM FGM is offline
external usenet poster
 
Posts: 35
Default Excel fraction not a date

I did say that it was a function.
dec2frac = LTrim(Str(intNumerator)) & "/" & LTrim(Str(intDenominator)) '
Display the numerator and denominator
This came from Erik Oosterwal..... He said to copy and paste it as a value
but that does not work on mine. Adding = "= " & the above puts an = sign as
text even when I format the field. My long way of finally doing it and it is
not a good answer was in the cell below formatted as a fraction.
=VALUE(LEFT(B6,FIND("/",B6,1)-1))/VALUE(MID(B6,FIND("/",B6,1)+1,10))

Thank you and I can try a sub that calls the function and puts in the
Selection.Formula = "= X"
Selection.Value = Selection.Value

Thanks again



"Gary''s Student" wrote:

It does not matter if its VBA or on the worksheet:

Sub frac()
Selection.Formula = "= 1/4"
Selection.Value = Selection.Value
End Sub


The space makes it a fraction and not a date. Format the cell to carrry the
proper number of digits in the numerator and denominator.
--
Gary''s Student - gsnu200724


"FGM" wrote:

Windows 2000, Excel 2003
How do you get excel to use a fraction as a fraction and not a date? I am
using a function that returns a fraction as a string. I then copy it and
paste it in a new cell as value.. I have tried formating the cell as a
decimal, as a fraction, it just keeps it as text or views it as a date....
any help would be appreciated.
Thanks.

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
fraction into date pm_sam Excel Discussion (Misc queries) 4 February 27th 10 01:41 PM
fraction into date pm_sam Excel Discussion (Misc queries) 3 February 3rd 10 09:30 PM
How do I convert a fraction to its true decimal, not a date no. 2HatsMcHattie Excel Discussion (Misc queries) 2 October 15th 07 09:25 AM
date has fraction instead of whole number Shlookonim Excel Discussion (Misc queries) 1 January 27th 06 03:49 PM
fraction getting convered into date bombayterror New Users to Excel 4 January 8th 06 09:27 PM


All times are GMT +1. The time now is 05:09 PM.

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

About Us

"It's about Microsoft Excel"