Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formula question 1

Status
Not open for further replies.

UnsolvedCoding

Technical User
Jul 20, 2011
424
US
This formula has ceased to work for some reason:

Test is a variable that holds the total number of rows with information below the header row.
B is the starting row for the loop - in this case 5.
C is the column which is 44 for this instance.

Sheets("Info").Cells(B, C + 1).Formula = _
"=COUNTIF(S5:T" & 5 + TEST & "=AR" & B & ")"

In other words this can be read as Sheets("Info").Cells(5, 45).Formula = "=COUNTIF(S5:T" & 5 + 9 & "=AR" & 5 & ")"
 
I do not idea how it ever worked. Then last paren appears to be in the wrong place. It appears the formula ( "=COUNTIF(S5:T" & 5 + 9 & "=AR" & 5 & ")" ) would evaluate to something like this: "=COUNTIF(S5:T14=AR5)". I think is should look like this "=COUNTIF(S5:T14)=AR5". Thus changing "=COUNTIF(S5:T" & 5 + 9 & "=AR" & 5 & ")" to "=COUNTIF(S5:T" & 5 + 9 & ")" & "=AR" & 5
 
hi,

[pre]
' COMMA
v
"=COUNTIF(S5:T" & 5 + 9 & ",AR" & 5 & ")"
[/pre]

Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]
 
I can't figure out what is going on. When I add extra " it says it expects ) or list separator. If I move the ) around it says there is an application defined or object defined error.

It has taken me a while to make sense of what I hear at work involving computers. There is much talk of bugs and questions about Raid.
Therefore I have come to the logical conclusion that the only way to have a properly functioning computer is to regularly spray it with Raid bug killer.
 
Still get the same error with a comma.

When I manually type the formula into the spreadsheet this is what it is =COUNTIF(S5:T9,"=AR5")

For what I am doing T9 changes. It stays in column T but the 9 changes based on the lines of information. Also the =AR5 changes, it stays in column AR but the 5 will increase for 10 rows.





It has taken me a while to make sense of what I hear at work involving computers. There is much talk of bugs and questions about Raid.
Therefore I have come to the logical conclusion that the only way to have a properly functioning computer is to regularly spray it with Raid bug killer.
 
I give up.

I did the comma again

Sheets("Info").Cells(B, C + 1).Formula = _
"=COUNTIF(S5:T" & 5 + TEST & ",AR" & B & ")"

And this time it worked.

Thanks Skip.

It has taken me a while to make sense of what I hear at work involving computers. There is much talk of bugs and questions about Raid.
Therefore I have come to the logical conclusion that the only way to have a properly functioning computer is to regularly spray it with Raid bug killer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top