Hi all, i have a job work with Excel and i want use formula to calculator the value of a cell. So i can’t write correct value of cell. Could anyone help me solve this problem?

Here is my value:

**"=COUNTIF(D10:AH10;“Lo”)+(COUNTIF(D10:AH10;“Lo/2”))/AJ10"**

I want instead number 10 by a dynamic value !!!

Assign A variable to make dynamic formula instead of 10

say CountNumber

Then formula will be:

“=COUNTIF(D”+CountNumber+":AH"+CountNumber+";"+""""+“Lo”+""""+")+(COUNTIF(D"+CountNumber+":AH"+CountNumber+";"+""""+“Lo/2"+""""+”))/AJ"+CountNumber

What range you has given

can you share screen shot of that activity

Before write cell put

Message Box and log message and write those all things

say

SheetName+vbcrlf+“AK”+CountRowsPermanent+vbcrlf+lastformula

check is it ryt or not

yeah, i know you mean, but i was tested SheetName and Range many time, when i write some value like “123” it’s work fine, but when i write formula, it’s not work.

is this gives you the ryt formula ?

when you print it in msgbox

You have enter wrong formula dear,

replace “;” with “,”

formula :

“=COUNTIF(D”+CountNumber+":AH"+CountNumber+","+""""+“Lo”+""""+")+(COUNTIF(D"+CountNumber+":AH"+CountNumber+","+""""+“Lo/2"+""""+”))/AJ"+CountNumber

Please try the following formula in the write cell activity -

`"=COUNTIF(D" + counter.ToString + ":AH" + counter.ToString + ";""Lo"") +(COUNTIF(D" + counter.ToString + ":AH" + counter.ToString + ";""Lo/2""))/AJ" + counter.ToString`

Regards,

Karthik Byggari

when i print value of formula, it’s match with static formula but it’s still has an error.

thank for support @KarthikByggari,@ImPratham45, althought my problem still not resolve but the both are the same correct solution for main my question.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.