I'm assuming $a$ and $b$ are natural numbers with $a\leq b$ and that $k$ is some real number greater then or equal to $1$, if so here are some different representations of your sum that you might find useful, in many instances these representations can be used to calculate your sum faster computationally or to get a better asymptotic estimate on your sum.
Now before we go any further we can assume with out a loss of generality that $k\ge a$.
If it is not then we will have $k<a<a+1<a+2<a+3\cdots <b-1<b$ which means that for any value of $x$ in the set $\{a, a+1, a+2, a+3\cdots b-1,b \}$ we will have $\frac{k}{x}<1\implies \lfloor \frac{k}{x}\rfloor=0$. Which means our entire sum will be equal to zero, and so were done.
Thus it comes down to dividing your sum into the two cases when $b\ge k$ and $b<k$.
We first start by using the Dirichlet hyperbola method so that we get:
$$\large{\sum_{x=1}^{\lfloor k \rfloor}\lfloor \frac{k}{x}\rfloor=- \lfloor y\rfloor\lfloor \frac{k}{y} \rfloor+\sum_{x=1}^{\lfloor y\rfloor}\lfloor \frac{k}{x}\rfloor+\sum_{x=1}^{\lfloor \frac{k}{y} \rfloor}\lfloor \frac{k}{x}\rfloor}$$
Now set $y=a-1$ and assume $a>1$, if it is not then you can always just set $a=2$ and add $\lfloor k \rfloor$ to both sides to give you the correct expressions.
We can then subtract the middle sum on the right from both sides which gives us:
$$\large{\sum_{x=a}^{\lfloor k \rfloor}\lfloor \frac{k}{x}\rfloor=-(a-1)\lfloor \frac{k}{a-1} \rfloor+\sum_{x=1}^{\lfloor \frac{k}{a-1} \rfloor}\lfloor \frac{k}{x}\rfloor}$$
Now suppose $b$ is greater then $k$, then for all $b>x>k$ we have $1>\frac{k}{x} \implies \lfloor \frac{k}{x} \rfloor=0$.
Thus $\sum_{x=a}^b\lfloor \frac{k}{x} \rfloor=\sum_{x=\lfloor k \rfloor+1}^b\lfloor \frac{k}{x} \rfloor+\sum_{x=a}^{\lfloor k \rfloor}\lfloor \frac{k}{x}\rfloor=0+\sum_{x=a}^{\lfloor k \rfloor}\lfloor \frac{k}{x}\rfloor=\sum_{x=a}^{\lfloor k \rfloor}\lfloor \frac{k}{x}\rfloor$
So we have if $b\ge k$:
$$\large{\sum_{x=a}^b\lfloor \frac{k}{x}\rfloor=-(a-1)\lfloor \frac{k}{a-1} \rfloor+\sum_{x=1}^{\lfloor \frac{k}{a-1} \rfloor}\lfloor \frac{k}{x}\rfloor}$$
And if $b<k$ subtracting the sum $\sum_{x=b+1}^{\lfloor k \rfloor}\lfloor \frac{k}{x}\rfloor$ from both sides gives:
$$\large{\sum_{x=a}^b\lfloor \frac{k}{x}\rfloor=-(a-1)\lfloor \frac{k}{a-1} \rfloor-\sum_{x=b+1}^{\lfloor k \rfloor}\lfloor \frac{k}{x}\rfloor+\sum_{x=1}^{\lfloor \frac{k}{a-1} \rfloor}\lfloor \frac{k}{x}\rfloor}$$
For example a special case is:
$$\large{ \sum_{x=1}^{b}\lfloor \frac{b}{x} \rfloor = -\lfloor \sqrt{b} \rfloor^2+2\sum_{x=1}^{ \lfloor \sqrt{b} \rfloor } } \lfloor \frac{b}{x} \rfloor$$
Notice how this turns our first sum of floor functions up to index $b$ into an expression involving the same floor functions but with a much smaller upper index of $\lfloor \sqrt{b} \rfloor$. This can be used to calculate the first sum much faster or to give a good asymptotic estimate on the sum.