ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help ... what wrong with this code (https://www.excelbanter.com/excel-programming/410961-help-what-wrong-code.html)

Chuong Nguyen

Help ... what wrong with this code
 

Column N is value - Column A is the result

here is the code:

Range("A2").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[13]80000,""$80,000 or above"",IF(RC[13]70000,""$70,000 -
$79,999"",IF(RC[13]60000,""$60,000 - $69,999"",IF(RC[13]50000,""$50,000 -
$59,999"",IF(RC[13]40000,""$40,000 - $49,999"",IF(RC[13]30000,""$30,000 -
$39,999"",IF(RC[13]20000,""$20,000 - $29,999"",IF(RC[13]15000,""$15,000 -
$15,999"",""$15,000 or below""))))))))"

but in Column A they all give me the result is: $80,000 or above
Even the amount is only 5000

Please Help


Best Regards




Bernie Deitrick

Help ... what wrong with this code
 
Chuong Nguyen,

Your values in column N are Text values, not numbers. Enter a 1 into a cell, copy it, select all
the values in N, right-click, choose paste-special / values / multiply / OK. Then format the cells
as currency with how ever many decimals you want.

HTH,
Bernie
MS Excel MVP


"Chuong Nguyen" wrote in message
...

Column N is value - Column A is the result

here is the code:

Range("A2").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[13]80000,""$80,000 or above"",IF(RC[13]70000,""$70,000 -
$79,999"",IF(RC[13]60000,""$60,000 - $69,999"",IF(RC[13]50000,""$50,000 -
$59,999"",IF(RC[13]40000,""$40,000 - $49,999"",IF(RC[13]30000,""$30,000 -
$39,999"",IF(RC[13]20000,""$20,000 - $29,999"",IF(RC[13]15000,""$15,000 - $15,999"",""$15,000 or
below""))))))))"

but in Column A they all give me the result is: $80,000 or above
Even the amount is only 5000

Please Help


Best Regards






Bernie Deitrick

Help ... what wrong with this code
 
And here is code for a better formula:

Range("A2").FormulaR1C1 = _
"=IF(RC[13]80000,""Above $80,000""," & _
"IF(RC[13]<15000,""Below $15,000"",""$"" & " & _
"INT(RC[13]/10000)&""0,000 - $""&" & _
"INT(RC[13]/10000)&""9,999""))"

HTH,
Bernie
MS Excel MVP


"Chuong Nguyen" wrote in message
...

Column N is value - Column A is the result

here is the code:

Range("A2").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[13]80000,""$80,000 or above"",IF(RC[13]70000,""$70,000 -
$79,999"",IF(RC[13]60000,""$60,000 - $69,999"",IF(RC[13]50000,""$50,000 -
$59,999"",IF(RC[13]40000,""$40,000 - $49,999"",IF(RC[13]30000,""$30,000 -
$39,999"",IF(RC[13]20000,""$20,000 - $29,999"",IF(RC[13]15000,""$15,000 - $15,999"",""$15,000 or
below""))))))))"

but in Column A they all give me the result is: $80,000 or above
Even the amount is only 5000

Please Help


Best Regards







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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com