Formula in Excel

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

Thank for help, but it’s still has an error Range does not exist.

What range you has given
can you share screen shot of that activity

Hi @ImPratham45, it’s here:

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

1 Like

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

1 Like

@TanVuong
is it work?

1 Like

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.

1 Like

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