Guest trigun Posted November 29, 2005 Share Posted November 29, 2005 I am extracting data from 2 fields, rs(“markup”) is a numeric fieldAnd rs(“cost”) is a currency field.I need to use rs(“markup”) to get a Percentage of rs(“cost”) then add that Percentage to rs(“cost”), then deliver the total as currency.I have tried using FormatPercent, but this delivers un-expected amounts (perhaps due to the decimal point in the currency field??) and delivers the result with a % on the end. Can anybody suggest a way of doing this? Link to comment Share on other sites More sharing options...
LBY Posted December 3, 2005 Share Posted December 3, 2005 If you want to change a number from a number to a precent you can just write the calculaiton yourself:for example let's take a poll system:Question: Do you like "Shimi"?A1: Yes (4 votes)A2: No (4 votes)How do you calculate the precents of the first answer for example?You take the number of votes for the first answer (4), divide it by the number of the total votes (8) and multiple it by 100:4 : 8 = 0.50.5 * 100 = 50%I'm not quite sure this is what you asked for so if it's not tell me and I will try to help Link to comment Share on other sites More sharing options...
kbqwert Posted December 23, 2005 Share Posted December 23, 2005 I am extracting data from 2 fields, rs(“markup”) is a numeric fieldAnd rs(“cost”) is a currency field.I need to use rs(“markup”) to get a Percentage of rs(“cost”) then add that Percentage to rs(“cost”), then deliver the total as currency.I have tried using FormatPercent, but this delivers un-expected amounts (perhaps due to the decimal point in the currency field??) and delivers the result with a % on the end. Can anybody suggest a way of doing this?<{POST_SNAPBACK}> TRY THIS:<%Dim TotalCostTotalCost = FormatCurrency(((rs(“markup”) / 100) * rs(“cost”)) + rs(“cost”))Response.Write TotalCost%> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now