Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi , i create UDF mypc which gives percent of the passed number as i need to
change the number format of given cell on some calculation, function mypc(rng as long) mypc=format(rng,"percent") end function Suppose In worksheet , A1 contains value 5 In B2, i type = mypc(A1) - RETURNS 500%, but i am not able to perform calculation on this returned values. please help Thanx |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Max,
The returned value is text, with which you can't calculate directly. You can use =VALUE(mypc(A1)) or, if you want the format to show, =VALUE(B1) if the formula is in B1 In case you wanted to ask; you cannot format a cell from a function. -- Kind regards, Niek Otten Microsoft MVP - Excel "Max" wrote in message ... | Hi , i create UDF mypc which gives percent of the passed number as i need to | change the number format of given cell on some calculation, | | | function mypc(rng as long) | mypc=format(rng,"percent") | end function | | Suppose In worksheet , A1 contains value 5 | | In B2, i type = mypc(A1) - RETURNS 500%, but i am not able to perform | calculation on this returned values. | | please help | Thanx |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
<with which you can't calculate directly
That's not entirely true. Some operations do accept text, but some functions fail. So it's better to convert it to a number using VALUE or multiply it by 1, for example. -- Kind regards, Niek Otten Microsoft MVP - Excel "Niek Otten" wrote in message ... | Hi Max, | | The returned value is text, with which you can't calculate directly. | You can use | | =VALUE(mypc(A1)) | | or, if you want the format to show, =VALUE(B1) if the formula is in B1 | | In case you wanted to ask; you cannot format a cell from a function. | | -- | Kind regards, | | Niek Otten | Microsoft MVP - Excel | | | "Max" wrote in message ... || Hi , i create UDF mypc which gives percent of the passed number as i need to || change the number format of given cell on some calculation, || || || function mypc(rng as long) || mypc=format(rng,"percent") || end function || || Suppose In worksheet , A1 contains value 5 || || In B2, i type = mypc(A1) - RETURNS 500%, but i am not able to perform || calculation on this returned values. || || please help || Thanx | | |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Calculate working days but change working week | Excel Discussion (Misc queries) | |||
Making weekend days working days - the system cuts the working tim | Excel Discussion (Misc queries) | |||
Newly created Get Function is not working when I copied the syntax from a working function | Excel Programming | |||
Macro working in Excel 2003; not working in Excel 2000 | Excel Programming | |||
Adding sales from a non working day to the previous working day | Excel Programming |