ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Correct Format for formula (https://www.excelbanter.com/excel-programming/357803-correct-format-formula.html)

parteegolfer

Correct Format for formula
 

Can anyone tell me what the correct format would be for this formula. I
know I am close however I keep getting a complile error


Code:
--------------------
.Offset(1, 2).Formula = "=CountIf(C7:C" & (lngLastRow - 1) ,"X")"
--------------------


--
parteegolfer
------------------------------------------------------------------------
parteegolfer's Profile: http://www.excelforum.com/member.php...o&userid=31951
View this thread: http://www.excelforum.com/showthread...hreadid=529020


Dave Peterson

Correct Format for formula
 
..Offset(1, 2).Formula = "=CountIf(C7:C" & (lngLastRow - 1) & ",""X"")"

Watch your commas and double quotes have to be doubled up within the string.

parteegolfer wrote:

Can anyone tell me what the correct format would be for this formula. I
know I am close however I keep getting a complile error

Code:
--------------------
.Offset(1, 2).Formula = "=CountIf(C7:C" & (lngLastRow - 1) ,"X")"
--------------------

--
parteegolfer
------------------------------------------------------------------------
parteegolfer's Profile: http://www.excelforum.com/member.php...o&userid=31951
View this thread: http://www.excelforum.com/showthread...hreadid=529020


--

Dave Peterson

parteegolfer

Correct Format for formula
 

Thanks Dave, However one more issue. How bout this one

..Offset(4, 2).Formula = "=.Offset(1,2)/.Offset(1,0)"


--
parteegolfer
------------------------------------------------------------------------
parteegolfer's Profile: http://www.excelforum.com/member.php...o&userid=31951
View this thread: http://www.excelforum.com/showthread...hreadid=529020


Tom Ogilvy

Correct Format for formula
 
.Offset(4, 2).Formula = "=" & .Offset(1,2).Value _
& "/" & .Offset(1,0).Value

or

.Offset(4, 2).Formula = "=" & .Offset(1,2).Value _
/ .Offset(1,0).Value

or

.Offset(4,2).Formula = "=" & .Offset(1,2).Address(0,0) _
& "/" & .Offset(1,0).Address(0,0)

or

.Offset(4,2).Formula = "=" & .Offset(1,2).Address _
& "/" & .Offset(1,0).Address


Depends on what you want as the final result.

--
Regards,
Tom Ogilvy



"parteegolfer"
wrote in message
news:parteegolfer.25nuby_1144020601.6365@excelforu m-nospam.com...

Thanks Dave, However one more issue. How bout this one

Offset(4, 2).Formula = "=.Offset(1,2)/.Offset(1,0)"


--
parteegolfer
------------------------------------------------------------------------
parteegolfer's Profile:

http://www.excelforum.com/member.php...o&userid=31951
View this thread: http://www.excelforum.com/showthread...hreadid=529020





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

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