I would like to create a macro to fill in a percent grid automatically in the most efficient manner

Who needs TikZ?

\documentclass{article}
\usepackage{pgffor,xcolor,graphicx}
\newcounter{z}
\newcommand\shazam[1]{%
\setcounter{z}{-#1}%
\rotatebox[origin=c]{90}{%
\scalebox{-1}[1]{%
\fboxsep=0pt\relax%
\fbox{\parbox{100pt}{\fontsize{10pt}{10pt}\selectfont%
\fboxsep=-\fboxrule\relax%
\foreach\z in{1,...,10}{%
\foreach\zz in{1,...,10}{%
\ifnum\thez<0\relax\fbox{\color{gray}\rule{10pt}{10pt}}\else
  \fbox{\color{white}\rule{10pt}{10pt}}\fi
\stepcounter{z}%
}%
\ifnum\z<10\\\fi
}}}}}}
\begin{document}
\shazam{43}
\shazam{17}\medskip

\shazam{89}
\shazam{67}
\end{document}

enter image description here

ZOOM:

enter image description here


Here is a possible to do that. Let's first define a pic.

\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}[scale=0.3,pics/percent grid/.style={code={
    \tikzset{percent grid/.cd,#1}
    \def\pv##1{\pgfkeysvalueof{/tikz/percent grid/##1}}%
    \pgfmathtruncatemacro{\nx}{\pv{p}/10}
    \pgfmathtruncatemacro{\ny}{Mod(\pv{p},10)}
    \ifnum\nx=0
     \ifnum\ny=0
     \else
      \path[percent grid/pfill] (-5,5) rectangle (-4,5-\ny);
     \fi
    \else
     \ifnum\ny=0
      \path[percent grid/pfill] (-5,5) rectangle (-5+\nx,-5);
     \else
      \path[percent grid/pfill] (-5,5) |- (-5+\nx,-5) |- (-5+\nx+1,5-\ny) |-cycle;
     \fi
    \fi
    \draw[line cap=rect] (-5,-5) grid (5,5);
 }},percent grid/.cd,p/.initial=0,pfill/.style={fill=black!20!white}]

 \path[transform shape] (0,0) pic{percent grid={p=43}}
  (12,0) pic{percent grid={p=3}}
  (0,-12) pic{percent grid={p=50}}
  (12,-12) pic{percent grid={p=100}};
\end{tikzpicture}
\end{document}

enter image description here

And this is macro version thereof.

\documentclass{article}
\usepackage{tikz}
\tikzset{pics/percent grid/.style={code={
    \tikzset{percent grid/.cd,#1}
    \def\pv##1{\pgfkeysvalueof{/tikz/percent grid/##1}}%
    \pgfmathtruncatemacro{\nx}{\pv{p}/10}
    \pgfmathtruncatemacro{\ny}{Mod(\pv{p},10)}
    \ifnum\nx=0
     \ifnum\ny=0
     \else
      \path[percent grid/pfill] (-5,5) rectangle (-4,5-\ny);
     \fi
    \else
     \ifnum\ny=0
      \path[percent grid/pfill] (-5,5) rectangle (-5+\nx,-5);
     \else
      \path[percent grid/pfill] (-5,5) |- (-5+\nx,-5) |- (-5+\nx+1,5-\ny) |-cycle;
     \fi
    \fi
    \draw[line cap=rect] (-5,-5) grid (5,5);
 }},percent grid/.cd,p/.initial=0,pfill/.style={fill=black!20!white}}
\newcommand{\mypercent}[2][]{\begin{tikzpicture}[#1]
\pic[scale=0.3]{percent grid={p=#2}};
\end{tikzpicture}} 
\begin{document}
\mypercent{43}
\end{document}

enter image description here