
422 So.2d 1085 (1982)
ERICKSON ENTERPRISES, INC., D/B/a Perkins Cake and Steak, and William Erickson, Appellants,
v.
LOUIS WOHL & SONS, INC., Appellee.
No. 82-36.
District Court of Appeal of Florida, Third District.
December 7, 1982.
Smoot, Johnston, Johnson & Green, Fort Myers, for appellants.
Jeffrey R. Roth, Miami, for appellee.
Before HUBBART, C.J. and BASKIN and FERGUSON, JJ.
FERGUSON, Judge.
Erickson appeals from a final judgment taxing attorneys fees and costs.
Wohl sued on a contract seeking to collect $4,620.60 allegedly owed by Erickson for new restaurant equipment. The contract provided, "... in the event collection action becomes necessary... all charges including court costs, attorney's fees and interest will be paid by the purchaser." Erickson filed an answer, thirteen affirmative defenses, and a counterclaim for $9,180.72. After a two-day non-jury trial final judgment for $3,885.00 was entered in favor of Wohl on his claim, and against Erickson on the counterclaim. By a subsequent order, from which this appeal is taken, the court awarded legal fees of $6,000.00 and costs of $794.00.
We first dispose of the challenge to the award of costs as without merit.
*1086 There was an agreement between Wohl and his attorneys that the fees for handling the contract action would be one-third of any recovery obtained on Wohl's complaint and $100.00 per hour for defending the counterclaim. It is conceded that, excluding the counterclaim, by terms of the agreement Wohl would be entitled to $1,300.00 in fees (1/3 of the recovery) for the collection action. The dispute is over the $4,700.00 excess.
Erickson makes three arguments: (1) it is not obligated to pay for the fees incurred in defending the counterclaim, (2) Wohl is entitled to no more than $1,300.00 because no additional work or time was required to handle the counterclaim, or (3) Wohl is entitled to no more than an additional $700.00 which Erickson's witness testified was the value of services for defending the counterclaim  arrived at by estimating that no more than seven hours, at $100.00 per hour, was required to handle the counterclaim.
Wohl counters: (1) because defense of the counterclaim was inseparably part of its suit on the contract it is entitled to a fee for defending the counterclaim, (2) defense of the counterclaim required more time and effort than the original action for collection, and (3) a separate award of fees cannot be made for Wohl's suit to collect on the contract and the defense of Erickson's counterclaim, therefore, the question is simply what is a reasonable fee, determination of which is within the sound discretion of the trial court.
We agree that on the facts of this case, it was appropriate to award Wohl a fee for defending against Erickson's counterclaim. Where a plaintiff, in order to recover in an action where the contract sued upon provides for attorney's fees, is required to prevail on the defendant's counterclaim which is based on the same contract, as well as on his own action, defense of the counterclaim is part and parcel of the original action and plaintiff is entitled to a fee for defending the counterclaim as well. See Peacock Construction Company v. Gould, 351 So.2d 394 (Fla. 2d DCA 1977). We see no reason to distinguish this case where the fee is based on contract, from Peacock where the fee was based on a statute.
But unlike Peacock, upon which Wohl relies, there is competent evidence in the record which suggests that the parties will have little difficulty preparing a breakdown of the number of hours spent on the collection action and the counterclaim.[1] Further, there is an agreement between the plaintiff and his attorney as to how the fee will be determined for both the collection suit and defense of the counterclaim. All the necessary elements are present for application of the correct standard for determining an appropriate fee: where two contracts exist, one between the parties and one between a party and his attorney, the fee shall be based on the actual agreement under which the claimant seeks indemnity for attorney's fees, if not excessive, or a reasonable fee, whichever is lower. Jemco, Inc. v. United Parcel Service, Inc., 400 So.2d 499 (Fla. 3d DCA 1981); Trustees of Cameron-Brown Investment Group v. Tavormina, 385 So.2d 728 (Fla. 3d DCA 1980). It was error to determine the amount of attorney's fees without considering the fee agreement between the claimant and his attorney.
Affirmed in part, reversed in part, and remanded for further consistent proceedings.
NOTES
[1]  Of course if the trial court makes a finding, supported by the record, that it is impossible to separate the legal work performed in the action to collect, from work done in defense of the counterclaim, then Peacock is controlling, and it would be appropriate to assess a reasonable fee, considering the factors set out in the Code of Professional Responsibility DR2-106(B).
