OPINION
SNOW, J.¶ 1 Marcel Barry Thomas appeals his convictions and sentences for the possession of dangerous drugs for sale, narcotics, drug paraphernalia, and marijuana. His lawyer found no arguable ground for reversal and filed a brief in accordance with Anders v. California, 386 U.S. 738, 87 S.Ct. 1396, 18 L.Ed.2d 493 (1967). Anders requires us to search the record for reversible error. Id. at 744, 87 S.Ct. 1396. We find no fundamental error pertaining to Thomas’s convictions. However, we ordered supplemental briefing on an issue pertaining to Thomas’s sentencing. Because we conclude that the trial court fundamentally erred in sentencing Thomas, we vacate the sentence and remand for resentencing.
FACTUAL AND PROCEDURAL HISTORY
¶ 2 The drug-related charges on which Thomas was sentenced arose from a search of Thomas’s apartment that occurred on December 18, 2002. Based on the evidence found during the search and Thomas’s statements to the police at that time, a grand jury indicted Thomas on four drug-related charges a year and a half later in June 2004. Thomas was indicted for possession of dangerous drugs for sale, a class two felony; possession of narcotic drugs, a class four felony; possession of drug paraphernalia, a class six felony; and possession of marijuana, a class six felony (“the drug-related charges”). Thomas was eventually tried and convicted on these charges in June 2005.
¶ 3 In January 2003, approximately one month after the police searched Thomas’s apartment and found the drugs and paraphernalia for which he was subsequently indicted, Thomas committed acts that resulted in charges being brought against him for aggravated assault, unlawful imprisonment, and hindering prosecution. Thomas was tried and convicted of these crimes in July 2004, almost a year before he was tried on the drug-related charges. After Thomas was convicted of these offenses and prior to his trial on the drug-related charges, the State submitted an addendum to the indictment on the December 2002 drug-related offenses seeking to add each of the convictions resulting from the January 2003 events as historical prior felony convictions.
¶ 4 Thomas objected because the January 2003 offenses occurred after the December 2002 drug-related offenses and thus could not constitute historical prior felony convictions. After a hearing, the court determined that to constitute a “prior historical felony conviction,” a class two, three, four or five felony must normally be committed prior to the commission of the offense on which the State seeks to enhance the sentence. Nevertheless, the court also concluded that, pursuant to the statutory definition, certain felony charges, regardless of their class, could constitute historical prior felony convictions even if they were committed after the offense for which the defendant was charged. Thus, in this case, the court determined that the unlawful imprisonment and the hindering prosecution charges could not constitute historical prior felony convictions pursuant to Arizona Revised Statutes (“A.R.S.”) section 13-604(W)(2)(b), (c) (Supp.2007) because the offenses occurred after the acts on which the drug-related charges were based. But it also determined that the aggravated assault charge, even though it also occurred after the drug-related offenses, could nevertheless constitute an historical prior felony conviction pursuant to A.R.S. § 13-604(W)(2)(a) because it carried with it a term of mandatory imprisonment. Thus, pursuant to § 13-604, the court sentenced Thomas to enhanced presumptive concurrent sentences on all four drug counts as follows: 9.25 years for the possession of dangerous drugs for sale, 4.5 years for the possession of narcotics, 1.75 years for the possession of drug para*415phernalia, and 1.75 years for the possession of marijuana.1
¶ 5 We have jurisdiction pursuant to Article 6, Section 9 of the Arizona Constitution and A.R.S. §§ 12-120.21(A)(1) (2003), 13-4031 (2001), and 13-4033(A)(1) (2001). We hold that the trial court erred when it sentenced Thomas pursuant to A.R.S. § 13-604 based on its determination that his aggravated assault conviction constituted an “historical prior felony conviction” even though it occurred after the drug-related crimes for which Thomas was convicted. Because sentencing error generally constitutes fundamental error, we vacate Thomas’s sentence and remand for resentencing. See State v. Hollenback, 212 Ariz. 12, 16, ¶ 12, 126 P.3d 159, 163 (App.2005) (holding that the “imposition of an illegal sentence is fundamental error”) (citation omitted).
ANALYSIS
¶ 6 “Section 13-604 provides enhanced sentences for defendants who are convicted of a felony and have a ‘historical prior felony conviction.’” State ex rel. Romley v. Hauser, 209 Ariz. 539, 541, ¶ 8, 105 P.3d 1158, 1160 (2005). Not all of a defendant’s previous felony convictions, however, will necessarily qualify as “historical prior felony convictions” because “whether a prior felony conviction falls within the definition of ‘historical prior felony conviction’ in § 13-604(V)[2] generally depends on the seriousness and age of the prior offense.” Id.
¶ 7 Section 13-604(W)(2) defines four different types of felony convictions as “historical prior felony convictions” depending upon the seriousness of the past offense and the time that has lapsed between that offense and the offense for which the defendant is charged. The first subcategory of “historical prior felony convictions,” includes “[a]ny pri- or felony conviction” for six types of designated offenses regardless of by how much the commission of the offense preceded the offense for which the defendant is charged.3 A.R.S. § 13-604(W)(2)(a). The second subcategory defines class two or three felonies as “historical prior felony convictions” if the offense resulting in the prior conviction “was committed within the ten years immediately preceding the date of the present offense.” A.R.S. § 13-604(W)(2)(b). The third subeategory, pertaining to generally less serious felonies, defines class four, five or six felonies as “historical prior felony convictions” if the offense resulting in the conviction “was committed within the five years immediately preceding the date of the present offense.” A.R.S. § 13-604(W)(2)(c). The fourth designates any conviction “that is a third or more prior felony conviction” as an historical prior felony conviction regardless of whether it meets other criteria. A.R.S. § 13-604(W)(2)(d).4
*416¶ 8 The trial court acknowledged that subsections (b) and (c) of the statute explicitly require that the prior offense precede the present offense. But, in the absence of such an explicit requirement in subsection (a), it held that such offenses need not have preceded the offense with which the defendant is charged to be considered a prior historical felony conviction.
¶ 9 We review questions of statutory interpretation de novo. Phelps Dodge Corp. v. Ariz. Dep’t of Water Res., 211 Ariz. 146, 148, ¶ 9, 118 P.3d 1110, 1112 (App.2006). In construing a statute, our goal is “to fulfill the intent of the legislature that wrote it.” Zamora v. Reinstein, 185 Ariz. 272, 275, 915 P.2d 1227, 1230 (1996) (internal quotations omitted). We first consider the statute’s language “because we expect it to be the best and most reliable index of a statute’s meaning.” Id. (internal quotations omitted). When a single provision of the statute is not clear in isolation, we determine legislative intent by reading the statute as a whole, by giving meaningful operation to all of its provisions, and by considering factors such as the statute’s context, subject matter, historical background, effects and consequences, and spirit and purpose. Id. We also interpret statutes “in such a way as to achieve the general legislative goals that can be adduced from the body of legislation in question.” Id. (internal quotations omitted). Further, “[i]n interpreting a criminal statute, we are also guided by the rule of lenity. This rule dictates that if a criminal statute is susceptible to more than one interpretation ... any doubt should be resolved in favor of the defendant.” State v. Garcia, 189 Ariz. 510, 513, 943 P.2d 870, 873 (App.1997) (internal quotations and citations omitted).
¶ 10 Among other types of felonies, subsection (a) of § 13-604(W)(2) designates as historical prior felony convictions “[a]ny prior felony conviction” for which imprisonment is mandatory. It is undisputed in this case that imprisonment is mandatory for a conviction of aggravated assault. Thus, if the aggravated assault conviction constitutes a “prior felony conviction,” it constitutes an “historical prior felony conviction” for the purposes of § 13-604. In interpreting “prior felony conviction” to merely mean an existing felony conviction, however, the trial court deprived the word “prior” of any meaning. If an existing conviction for any of the felonies designated by § 13-604(W)(2)(a) constitutes an “historical prior felony” then there is no need to require, as § 13-604(W)(2)(a) does, that an “historical prior felony conviction” be for a “prior felony conviction.” A court avoids an interpretation that would render “any of its language mere ‘surplusage’ instead, we “give meaning to ‘each word, phrase, clause, and sentence ... so that no part of the statute will be void, inert, redundant, or trivial.’” Phoenix City Prosecutor’s Office v. Ybarra, 215 Ariz. 374, 379, ¶ 21, 160 P.3d 695, 700 (App.2007) (quoting Walker v. City of Scottsdale, 163 Ariz. 206, 210, 786 P.2d 1057, 1061 (App.1989) (internal citations omitted)). The word “prior” is given meaning if it is interpreted to require that the “prior felony” be committed before the offense for which the defendant will be sentenced. See Garcia, 189 Ariz. at 513, 943 P.2d at 873 (concluding that the word “prior” in the statutory phrase prior felony conviction “has an implicit retrogressive meaning....”). Otherwise it is deprived of any significance.
¶ 11 Our supreme court previously interpreted “prior felony conviction” in the context of this same statute to require that the commission of the prior felony precede the commission of the offense with which the defendant is charged. State v. Thompson, 200 Ariz. 439, 441, ¶ 6, 27 P.3d 796, 798 (2001). In Thompson, the court held that the defendant had been convicted of crimes to which he had pled guilty even though he had not yet been sentenced for those crimes. In that case, the defendant committed two drug offenses. Id. at 440, ¶ 2, 27 P.3d at 797. Eleven days after the second drug offense, he committed theft. Id. He pled guilty to the two drug offenses, but because he absconded he was not sentenced on the drug offenses even though the court had accepted his guilty plea. Id. Thereafter, he was tried and convicted on the separate theft charge. Id. When the State sought to classify the drug convictions as historical prior felony convictions for purposes of enhancing his sentence on the later-occurring theft, Thomp*417son argued that the drug offenses could not be historical prior felonies because he had not yet been sentenced for the drug offenses, even though he had pled guilty to them prior to his conviction on the theft offenses. Id. at ¶¶ 3-4, 27 P.3d 796. The supreme court rejected that argument. Id. at 440-41, ¶¶ 6-9, 27 P.3d at 797-98.
¶ 12 In so doing, however, despite the absence in subsection (c) of an explicit requirement that the defendant be convicted of an historical prior felony prior to being convicted of the present offense, the supreme court also held that such a requirement existed:
The statute does not refer to the timing of the conviction for the prior offense. It just requires the prior offense to precede the present offense. [The defendant], however, argues that the term “historical prior felony conviction,” means the conviction must precede the present offense. But the statute provides only that the prior offense must precede the present offense. We do agree that the language “prior felony conviction” means something: the conviction on the prior offense must precede the conviction on the present offense. In the same subsection of the statute, two of the other definitions of “historical prior felony convictions” presuppose a conviction on the prior offense. A.R.S. § 13-604(V)(l)(a) [and] (d). It would be absurd for the statute to require a conviction for more serious felonies, but not for less serious felonies such as [the defendant’s] drug offenses.
Id. at 441, ¶ 6, 27 P.3d at 798 (emphases added).
¶ 13 In interpreting the phrase “prior felony conviction” to require that the conviction on the prior offense precede the conviction on the present offense, the supreme court clarified that it required both a prior offense and that the conviction on the prior offense precede the conviction on the present offense. “[T]he conviction on the prior offense must precede the conviction on the present offense.” Id. (emphasis added). Thus, to constitute an historical prior felony conviction, a felony must be committed prior in time to the offense(s) with which the defendant is presently charged, and the conviction on that prior offense must occur prior to the conviction on the present offense.
¶ 14 In arriving at this interpretation, the court in Thompson also examined the statutory definition as a whole, using the presuppositions of a prior conviction in subsections (a) and (d) to inform the explicit requirement in subsections (b) and (c) that the commission of the prior offense precede the commission of the present offense. By interpreting the phrase “prior felony conviction” to require both, it gave the phrase a logical and consistent meaning throughout the statute. “We strive to construe a statute and its subsections as a consistent and harmonious whole.” State v. Wagstaff 164 Ariz. 485, 491, 794 P.2d 118, 124 (1990) (citation omitted).
¶ 15 When our supreme court re-examined the statutory definition of “historical prior felony conviction” in Hauser, it again noted that “the relevant measurement [in determining whether a conviction is an historical prior felony conviction is] from the date of the prior offense to the date of the present offense.” 209 Ariz. at 542 n. 2, 105 P.3d at 1161 n. 2. This court followed the supreme court in that respect, interpreting the phrase “historical prior felony conviction” in § 13-604(W) to “mean that ‘the conviction on the prior offense must precede the conviction on the present offense.’” State v. Ofstedahl, 208 Ariz. 406, 407, ¶ 4, 93 P.3d 1122, 1123 (App.2004) (quoting Thompson, 200 Ariz. at 441, ¶ 6, 27 P.3d at 798 (emphases added)).
¶ 16 The trial court’s interpretation of § 13-604(W)(2)(a) in this case is inconsistent with these authoritative interpretations of the statute. It also frustrates the harmony of the interpretation provided by the supreme court. The supreme court’s interpretation of § 13-604(W)(2) merely imposes different time requirements by which the prior felony must precede the present offense depending upon the seriousness of the prior offense. The trial court, however, interpreted the various subsections of § 13-604(W)(2) to adopt different standards for determining the nature of a prior felony conviction that apply differently with respect to the same facts.
*418¶ 17 For example, Thomas committed the crimes of aggravated assault, unlawful imprisonment and hindering prosecution after he committed the crimes with which he was charged. Because these acts were committed after he had committed the drug-related offenses, the trial court correctly concluded that the unlawful imprisonment and hindering prosecution charges could not be “prior felony convictions” to the drug-related charges under § 13-604(W)(2). But, it arrived at the anomalous conclusion that even though the aggravated assault was committed at the same time, it could nevertheless constitute an historical prior felony conviction to the drug-related offenses. Such an interpretation imposes an inconsistent meaning on the phrase “prior felony conviction” within the same statutory subsection and with respect to the same facts.
¶ 18 Further, it is inconsistent with the intent of the Legislature. In an initial reference to A.R.S. § 13-604 shortly after its passage, our supreme court made clear that in most cases, statutes like A.R.S. § 13-604, defining an historical prior felony, require both that a crime take place and that the defendant be convicted of that crime prior to the offense for which the defendant is being charged for the first offense to constitute an historical prior felony conviction for the second. The reason for this requirement is “to serve as a warning to first offenders and encourage their reformation.” It observed:
Recidivist or enhancement statutes, A.R.S. § 13-604 in the new Criminal Code, generally require that the prior conviction be based on an offense committed before the offense for which the defendant is being sentenced. Both the prior conviction and the prior offense must have occurred before the second offense was committed. This view is in harmony with the purpose of the recidivist or enhancement statute, which is to serve as a warning to first offenders and encourage their reformation.
State v. Steelman, 126 Ariz. 19, 25, 612 P.2d 475, 481 (1980).
¶ 19 However, within months, the supreme court clarified in State v. Hannah, 126 Ariz. 575, 576, 617 P.2d 527, 528 (1980), the difference between § 13-604 and “true recidivist statutes.” In Hannah, the defendant committed four forgeries in early November 1978. Id. He subsequently committed three class two felonies on August 10, 1979. Id. at 575, 617 P.2d at 527. The defendant was convicted of the November 1978 forgery charges in October 1979, several months after he committed the August felonies. Id. at 576, 617 P.2d at 528. Prior to the defendant’s trial on the August felonies, the county attorney alleged that the November 1978 forgery charges on which he had been convicted in October 1979 were historical prior felonies to the August 1979 felonies. Id. The supreme court agreed and held that in circumstances in which the prior offense preceded the principal offense, the conviction on the prior offense need not occur before the principal offense was committed to enhance a sentence under § 13-604. Id. at 577, 617 P.2d at 529.
¶ 20 Although Hannah did not involve offenses committed on separate occasions that were consolidated for trial, the court did note that its conclusion was bolstered by subsection (H) of § 13-604 that applied to such circumstances. As it then existed subsection (H) stated:
[c]onvictions for two or more offenses not committed on the same occasion but consolidated for trial purposes may, at the discretion of the state, be counted as prior convictions for purposes of this section. Convictions for two or more offenses committed on the same occasion shall be counted as only one conviction for purposes of this section.
The court observed that in the case of separate criminal offenses consolidated for trial, “subsection H of § 13-604 makes it clear that conviction of the other offense need not occur prior to the commission of the principal offense.” Id. at 576, 617 P.2d at 528.
¶ 21 Four years later in State ex rel. Collins v. Superior Court, 142 Ariz. 280, 689 P.2d 539 (1984), the supreme court suggested that subsection (H) applied to the sequence of the commission of offenses combined for trial as well as to the sequence of convictions. In that case, the State consolidated two separate criminal charges against the defendant for purposes of indictment and trial pursuant *419to subsection (H). Id. at 281, 689 P.2d at 540. Of the two different charges that were to be concurrently tried, the State sought to have the charge that was committed first designated as a prior conviction for the crime that was committed second. Id. The Collins court noted that subsection (H) provided for consolidated trials; it also recognized the previous dicta in Hannah which stated that in such cases, either conviction could constitute an historical prior conviction for the other. Id. While it was not necessary to the decision in Collins, the court then suggested that, when charges were consolidated for trial, subsection (H) also authorized a subsequently committed crime to constitute a prior conviction to a first crime so long as the charges were concurrently tried and there was a conviction for that subsequent crime. Id. at 282, 689 P.2d at 541. “We believe subsection (H) provides ... [a] prior conviction may be used to enhance a subsequent conviction even though the prior conviction was for an offense which occurred after the occurrence of the offense which formed the basis of the subsequent conviction.” Id.
¶ 22 Collins was the only Arizona case to suggest that a subsequently committed felony could nevertheless constitute a “prior conviction.” However, Collins explicitly relied on subsection (H) as exclusive authority for that anomalous result. Since that time, as our supreme court recently explained in discussing the history of § 13-604, “the legislature eliminated the ‘consolidated for trial’ provision of § 13-604(H) ... and thus put an end to sentence enhancement under § 13-604 for ‘prior’ convictions occurring at the same trial.” Hauser, 209 Ariz. at 541, ¶ 13, 105 P.3d at 1160; see also Ofstedahl, 208 Ariz. at 408, ¶ 5, 93 P.3d at 1124 (holding that “the legislature eliminated Hannah priors by deleting that provision in its 1993 revision of the sentencing code.... Consequently, [cases interpreting and applying former § 13-604Q3) ] are not applicable....”).
¶ 23 When the Legislature deleted subsection (H) it also revised A.R.S. § 13-702.02 (2001) to provide a less-severe sentencing enhancement for a defendant who is tried for multiple crimes at the same trial.5 Nevertheless, in such cases, the Legislature specified that the sentencing enhancement is only available for the “second or subsequent offense.” A.R.S. § 13-702.02(A). “Conviction for the later offense therefore cannot be used under § 13-702.02 to enhance the sentence for the earlier offense, no matter when the conviction for the later offense occurs.” Hauser, 209 Ariz. at 543, ¶ 20, 105 P.3d at 1162. Therefore, with the deletion of the relevant portion of subsection (H), the Legislature deleted the only statutory authority that has ever been interpreted to allow a subsequently-committed crime to count as a prior conviction for purposes of enhancing the punishment on an offense committed earlier. The “decision to delete language ... is strong evidence that [the] Legislature did not intend [the] omitted matter should be effective.” Stein v. Sonus USA, Inc., 214 Ariz. 200, 203, ¶ 11, 150 P.3d 773, 776 (App.2007) (internal quotations omitted). Even if such authority still existed, it would not be applicable here, as Thomas was not concurrently tried on separate criminal charges.
¶ 24 The dissent cites State v. Phillips, 202 Ariz. 427, 441, ¶ 77, 46 P.3d 1048, 1062 (2002), for the proposition that pursuant to § 13-604(W)(2)(a), a subsequent offense can serve as an historical prior felony conviction if the conviction for the subsequent offense occurs before the conviction on the present offense. However, that was not the issue the court was analyzing in Phillips.
¶ 25 In Phillips, the defendant committed robberies with another defendant on April 12, 24, and 28 of 1998. Id. at 431, ¶ 1, 46 P.3d at 1052. A number of separate crimes occurred during these robberies, including a homicide that occurred during the course of the last robbery on April 28. Id.
¶ 26 Two days before the April 28 robbery, on April 26, 1998, Phillips committed a robbery by himself. Id. at 441, ¶ 77, 46 P.3d at 1062. Phillips was convicted of the April 26 robbery and related charges before he was tried for the string of robberies he commit*420ted with the accomplice that included the April 28 homicide. See id.
¶27 Like Thompson, the defendant in Phillips only argued that because he had not been convicted of the April 26 robbery at the time that he committed the other three robberies, his conviction on the April 26 robbery could not be used to enhance the sentence for the non-homicide charges arising from the other three robberies. Id. The court, in citing Thompson, noted that “[w]e have previously rejected this argument.” Id. at ¶ 78. It then held that because the conviction for the April 26 robbery was entered before the convictions for the other robberies, Phillips’ conviction for the prior offense preceded the conviction for the offense for which Phillips was charged and was thus not disqualified from being an historical prior felony conviction. Id.
¶ 28 Phillips did not raise, and the Arizona Supreme Court did not address, whether under Thompson it was error for the superior court to use a conviction for a subsequent crime to enhance the defendant’s sentences for the April 12 and April 24 robberies. Although Thompson suggests that it was error, this argument was not raised by the defendant, and because the sentences actually imposed on Phillips for the April 12 and 24 non-homicide offenses were not discussed in Phillips, it is not clear whether the enhancement had any practical effect on Phillips’ non-homicide sentences. Thus, Phillips is not on point.6
¶ 29 After considering the plain language of the statute read as a whole, the case law, and the statutory history, we conclude that in order to qualify as a “prior felony conviction” pursuant to A.R.S. § 13-604(W)(2)(a), the prior offense must precede the offense for which the defendant is charged, and the prior conviction must precede the conviction on the crime charged. It was thus error for the trial court to treat the aggravated assault conviction as an historical prior felony in sentencing Thomas.
CONCLUSION
¶30 Based on the foregoing, we vacate Thomas’s sentence and remand for resen-tencing consistent with this opinion.
CONCURRING: DONN KESSLER, Judge.. Without the enhancement, Thomas’s presumptive sentences would have been five years for count one, two and one half years for count two, and one year for each of count three and count four.
. A.R.S. § 13-604(W)(2)(a)-(d) was previously numbered A.R.S. § 13-604(V)(l)(a)-(d). The current statutory provisions were renumbered, but remain substantively the same. 2005 Ariz. Sess. Laws, ch. 188, § 1 (1st Reg.Sess.).
. In describing this same statutory subsection, our supreme court indicated that "subdivision (a) ... lists six types of offenses that can be alleged as historical prior felony convictions no matter when they occurred.” State v. Christian, 205 Ariz. 64, 66-67, ¶ 7, 66 P.3d 1241, 1243-44 (2003). Of course, in the context of the court’s general description of this subsection the phrase is accurately understood as meaning no matter when the felonies occurred prior to the commission of the felony to which they are alleged to be an historical prior.
. The statutory provision states as follows:
2. "Historical prior felony conviction” means:
(a) Any prior felony conviction for which the offense of conviction:
(i) Mandated a term of imprisonment ...
(b) Any class 2 or 3 felony, except the offenses listed in subdivision (a) of this paragraph, that was committed within the ten years immediately preceding the date of the present offense____
(c) Any class 4, 5 or 6 felony, except the offenses listed in subdivision (a) of this paragraph, that was committed within the five years immediately preceding the date of the present offense....
(d) Any felony conviction that is a third or more prior felony conviction.
A.R.S. § 13-604(W)(2).
. In 1996, through a further amendment, the Legislature also extended this less-severe enhancement to defendants who have been convicted and who have prior felony convictions that “are not historical prior felony convictions as defined in § 13-604.” A.R.S. § 13-702.02(A).
. In Phillips, the sentencing enhancement at issue pertained only to the non-homicide convictions. “The trial court relied on Phillips’ prior felony convictions from the robbeiy he committed alone on April 26, 1998, to enhance his non-homicide convictions from the April 12, 24, and 28 robberies.” Phillips, 202 Ariz. at 441, ¶ 77, 46 P.3d at 1062. Thus, any failure by Phillips to raise available arguments on appeal did not occur in the context of a death penalty review.