Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default R1C1 to A1 inaccurate formula conversion

Hello once again,

I use the following macro (suggested - in its original version - by Tom
Hutchins, thanks!):

Sub Test2()
Dim x As Long, Rng As Range
x& = Range("L" & Rows.Count).End(xlUp).Row
Set Rng = Range("O2:O" & x&)
Rng.FormulaR1C1 = "=IF(RC[-1]="","",COUNTIF(R2C14:R5000C14,RC[-1]))"
Set Rng = Nothing
End Sub

I have a problem converting the formula from:
=IF(RC[-1]="","",COUNTIF(R2C14:R5000C14,RC[-1]))
To
=IF(N2="";"";COUNTIF($N$2:$N$5000;N2))

In fact, it converts to:
=IF(N2=",";COUNTIF($N$2:$N$5000;N2))

Any idea what am I doing wrong?
Thanks,
Mark


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default R1C1 to A1 inaccurate formula conversion

Double up your double quotes in your code.

Rng.FormulaR1C1 = "=IF(RC[-1]="","",COUNTIF(R2C14:R5000C14,RC[-1]))"
becomes
Rng.FormulaR1C1 = "=IF(RC[-1]="""","""",COUNTIF(R2C14:R5000C14,RC[-1]))"



markx wrote:

Hello once again,

I use the following macro (suggested - in its original version - by Tom
Hutchins, thanks!):

Sub Test2()
Dim x As Long, Rng As Range
x& = Range("L" & Rows.Count).End(xlUp).Row
Set Rng = Range("O2:O" & x&)
Rng.FormulaR1C1 = "=IF(RC[-1]="","",COUNTIF(R2C14:R5000C14,RC[-1]))"
Set Rng = Nothing
End Sub

I have a problem converting the formula from:
=IF(RC[-1]="","",COUNTIF(R2C14:R5000C14,RC[-1]))
To
=IF(N2="";"";COUNTIF($N$2:$N$5000;N2))

In fact, it converts to:
=IF(N2=",";COUNTIF($N$2:$N$5000;N2))

Any idea what am I doing wrong?
Thanks,
Mark


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default R1C1 to A1 inaccurate formula conversion

Thanks, it works great!
(should have found it by myself :-((

"Dave Peterson" wrote in message
...
Double up your double quotes in your code.

Rng.FormulaR1C1 = "=IF(RC[-1]="","",COUNTIF(R2C14:R5000C14,RC[-1]))"
becomes
Rng.FormulaR1C1 = "=IF(RC[-1]="""","""",COUNTIF(R2C14:R5000C14,RC[-1]))"



markx wrote:

Hello once again,

I use the following macro (suggested - in its original version - by Tom
Hutchins, thanks!):

Sub Test2()
Dim x As Long, Rng As Range
x& = Range("L" & Rows.Count).End(xlUp).Row
Set Rng = Range("O2:O" & x&)
Rng.FormulaR1C1 = "=IF(RC[-1]="","",COUNTIF(R2C14:R5000C14,RC[-1]))"
Set Rng = Nothing
End Sub

I have a problem converting the formula from:
=IF(RC[-1]="","",COUNTIF(R2C14:R5000C14,RC[-1]))
To
=IF(N2="";"";COUNTIF($N$2:$N$5000;N2))

In fact, it converts to:
=IF(N2=",";COUNTIF($N$2:$N$5000;N2))

Any idea what am I doing wrong?
Thanks,
Mark


--

Dave Peterson



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
sum inaccurate Terry Excel Worksheet Functions 4 March 16th 09 08:43 AM
Question on this conversion code switching between r1c1 to A1 format tia sal2 temp Excel Worksheet Functions 1 September 16th 07 06:54 AM
Question on this conversion code switching between r1c1 to A1 format tia sal2 temp Excel Discussion (Misc queries) 2 September 14th 07 08:58 PM
Question on this conversion code switching between r1c1 to A1 format tia sal2 temp Excel Worksheet Functions 2 September 14th 07 08:58 PM
R1C1 Formula in Excel Barb Reinhardt Excel Worksheet Functions 2 December 8th 05 02:40 PM


All times are GMT +1. The time now is 02:02 AM.

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"