Hello everyone. This is JT Rieck, Executive Vice President of Finance and Investor Relations. Welcome to the pre-recorded discussion of Flowers Foods fourth quarter and full year 2022 results, which we announced in a press release on February 9th, 2023. We will host a live Q&A session on Friday, February 10th at 8:30 A.M. Eastern. Further details about the live call, along with our earnings release a transcript of these recorded remarks, and a related slide presentation are posted on the investor section of flowersfoods.com. Before we get started, keep in mind that the information presented here may include forward-looking statements about the company's performance. Although we believe these statements to be reasonable, they are subject to risks and uncertainties that could cause actual results to differ materially.
In addition to what you hear in these remarks, important factors relating to Flowers Foods business are fully detailed in our SEC filings. Providing remarks today are Ryals McMullian, President and CEO, and Steve Kinsey, our CFO. Ryals, I'll turn it over to you.
Thanks, JT. It's a pleasure to welcome everyone to our call. Our record sales in fiscal 2022 reflect the strong performance of our leading brands and outstanding execution by the Flowers team. Those results were achieved despite high inflation, which is pressuring consumers and encouraging trade down to lower priced products. Faced with these and other challenges throughout the year we continued to advance our strategic plans, and we were able to achieve respectable top and bottom line performance. As we look ahead to 2023, we expect an environment featuring continued high but hopefully declining inflation and the possibility of a recession. Despite these challenges, we intend to continue investing in our business bringing more innovation to market, while also implementing our digital transformation and supply chain initiatives.
While these investments will impact our near-term results and contribute to a below algorithm year, I am confident that they will enhance an already strong foundation and position us for future growth once these headwinds subside. We're taking proactive measures not only to mitigate short-term inflationary pressures but to reestablish ourselves as a low-cost producer in the industry for the long pull. I've challenged our team to redouble their efforts with specific actions to drive savings and improve efficiencies so that we emerge from this period even stronger. In a moment, I'll give more detail on some of the steps we're taking to position ourselves for continued long-term success. I'll provide an overview of our 2022 performance in the context of our four strategic priorities, developing our team, focusing on our brands, prioritizing margins and pursuing smart M&A.
Following that, Steve will review our fourth quarter financial results and our 2023 guidance, and then I'll come back with a discussion on key themes moving forward and our plan to drive growth in 2023 and beyond. I'd like to start by recognizing the incredible contributions of our team, whose dedication and resiliency in this challenging environment continue to inspire me. Their performance in the face of inflation, supply chain disruptions, labor shortages and severe weather enabled us to push through the challenges and deliver solid results. We have made progress in reducing job openings in our bakeries and the labor environment seems to be improving. However, we will continue to invest in what I believe is the best team in the industry and we're working hard to ensure that Flowers continues to be recognized as a destination workplace.
In addition, to implementing programs with our current workforce to be sure we have the right people in the right jobs, we're taking steps to showcase the attractive career path available to new employees. Although many of our internal initiatives are in their infancy, we are optimistic about their potential to drive future improvement in recruitment and retention. Our second strategic priority is focusing on our brands. The current inflationary environment underscores the importance of strong brands. Nature's Own, Dave's Killer Bread and Canyon Bakehouse all maintain unit share in the fourth quarter as consumers continued to recognize their differentiated attributes. That performance came despite a challenging environment where private label gained 90 basis points of share and our portfolio strategy is working as expected. The two portfolio roles we're focused on, aggressive growth and learn improve, both grew at rates exceeding our company average.
We're capitalizing on our strong brands to bring new and innovative products to market. Following their outstanding performance in test markets, we are expanding distribution of DKB bars nationally. The rollout to retailers began in January and will continue throughout the year. While it's still too early to report any initial results, we are excited about their potential, and feedback from retailers and consumers alike has been positive. To support what we believe is the first step in the establishment of a DKB snack portfolio, we're placing significant marketing support behind the introduction. That expense will contribute to the headwinds for 2023 I mentioned earlier. In addition to the bars, we have an exciting pipeline of other innovative products, including DKB Crunchy Snack Bites and Nature's Own Breakfast pastries, which are available for trial on our site, creationsbyflowersfoods.com.
Our third strategic priority is margins, which remain our particular focus given the inflationary environment. We've mitigated much of the impact of higher costs through a combination of price increases and efficiency initiatives. Our cost savings initiatives generated $24 million in benefits for the year and we expect to achieve another $20 million-$30 million in 2023. Although our margin percentage declined in the fourth quarter and fiscal year, we grew adjusted EBITDA in dollars by 8.5% and 2.3% respectively. Moving forward, we're focused on implementing further initiatives to drive margin improvement. Bakery of the Future is one such program that is making progress. In 2022, it went live in 14 bakeries and we expect to add another 18 this year.
As Bakery of the Future hits critical mass, we anticipate the benefits of real-time data to begin flowing through. Importantly, in 2023, we're committed to investing further in supply chain capabilities to support these and other initiatives. We expect these added capabilities to drive a greater emphasis on preventive maintenance, waste reduction, logistics efficiencies and overall equipment effectiveness. Capital investments to upgrade equipment and increase automation should contribute to our gains. In addition to these specific programs, we're instilling a culture of continuous productivity improvement that's intended to endure beyond this inflationary period. Over the long term, we expect that culture shift in combination with our portfolio strategy to drive meaningful improvement in our margins. Our fourth priority is smart M&A. In December, we announced an agreement to acquire Papa Pita Bakery, a manufacturer and distributor of high-quality bagels, tortillas, breads, buns, English muffins and flatbreads.
Papa Pita has been an important co-manufacturer of Flowers products for many years and we expect the acquisition to drive further manufacturing and distribution synergies. We anticipate this transaction will close in the first quarter of this year. As always, we continue to monitor the deal market, actively seeking potential acquisitions and investments that add capabilities, brands, or products to our robust existing lineup. Our strong balance sheet positions us well to act when we have financial, commercial and operational conviction. I am pleased to report that in keeping with our track record of shareholder-friendly capital allocation, Flowers was recently added to the S&P High Yield Dividend Aristocrats Index, which includes companies that have increased their dividend every year for at least 20 years. Enabled by our strong free cash flow, we're proud of our long track record of dividend payments.
Now I'll turn it over to Steve to review the details of the quarter and then I'll come back later to discuss our outlook for the current business environment. Steve?
Thank you, Ryals. Hello, everyone. Let me echo your comments on our incredible team and express my sincere thanks for their outstanding efforts in a challenging environment. Before I get into the Q4 results, I'd like to highlight a change in our sales presentation. Consistent with our portfolio strategy to drive greater sales of higher-margin branded retail products, beginning with the fourth quarter and full year 2022 report, we are disaggregating our sales into two categories: branded retail and other. The latter category encompasses what we formerly refer to as store-branded retail and non-retail and other. We will also provide price mix and volume detail for both categories. In addition to being better aligned with our strategy, we hope that this additional detail will provide more insight into our business. Moving on to our results.
Total sales in the fourth quarter increased 10.1% from the prior year period. Improved price mix drove the adjusted year-over-year increase, up 16.7%, primarily due to price increases to mitigate inflationary pressures. Volume decreased 6.6%, a significant portion of which was due to targeted sales rationalizations in cake and food service. Gross margin as a percentage of sales, excluding depreciation and amortization, decreased 110 basis points to 46.8%. Comparisons were impacted by higher ingredient and packaging costs, partly offset by lower incentive compensation and reduced outside purchases of product. Selling, distribution, and administrative expenses decreased 110 basis points as a percentage of sales to 37.9% in the fourth quarter.
Results benefited from lower incentive compensation expense, reduced distributor distribution fees as a percent of sales, lower rent expense due to the purchase of 27 leased warehouses in the prior year, and an increased gain on sale of assets. These items were partly offset by higher logistics and bad debt expense. Excluding matters affecting comparability, adjusted SD&A expenses decreased 100 basis points to 37.9%. GAAP diluted EPS for the quarter was $0.23 per share, compared to $0.18 in the prior year period. Excluding the items affecting comparability detailed in the release, adjusted diluted EPS in the quarter was $0.23 per share, up $0.03 from the prior year period. Turning now to our balance sheet, liquidity and cash flow.
For fiscal 2022, cash flow from operating activities increased by $16.3 million to $360.9 million, which included business process improvement consulting cost of $33.2 million related to the ongoing transformation strategy initiatives. Capital expenditures increased $33.1 million to $169.1 million, including $61.3 million for the ongoing ERP upgrade. Dividends paid increased $10.6 million to $186.5 million. In the second quarter, our board of directors increased the company's share repurchase authorization by 20 million shares. In fiscal 2022, we repurchased $34.6 million of common stock, leaving 24.4 million shares remaining for repurchase under the company's current share repurchase plan. Our financial position remains strong.
At the end of fiscal 2022, net debt to trailing twelve-month adjusted EBITDA stood at approximately 1.4x . At fiscal year-end, we held approximately $165 million in cash and cash equivalents and had approximately $687 million of remaining availability on our credit facilities. Turning to our outlook for 2023, which reflects significant investments in our strategic priorities and actions to address the inflationary environment. We are forecasting sales to increase 7.7%-9.1%. Adjusted EBITDA is expected to be $513 million-$543 million, with adjusted EPS in the range of $1.20-$1.30 per share.
A significant portion of our investments in 2023 relate to the ongoing upgrade of our ERP system. We expect the impact of these costs to peak in 2023 as we begin to roll out the system across our network. Our adjusted EBITDA guidance incorporates approximately $26 million or approximately $0.09 per share of incremental costs related to this project. We anticipate these costs to moderate substantially by project completion in 2026. Additionally, we expect an impact of $0.08-$0.10 per share from an increase in interest, depreciation and amortization expense associated with the ERP implementation and Papa Pita acquisition. We expect 2023 D&A in the range of $160 million-$165 million compared to $142 million in 2022.
Capital expenditures are expected to range from $140 million-$150 million, $20 million-$30 million of which is related to the upgrade of our ERP system. Key factors that could shift results within our guidance range include pricing, consumer resilience, and continued inflationary pressure. We implemented significant price increases in 2022, some of which will not be lapped until midyear 2023. We are also implementing additional price increases in 2023 particularly to improve the profitability of our lower margin food service and private label businesses, as well as to address higher commodity costs across our product portfolio. Overall, demand elasticity has been in line with our expectations, remaining below historical levels. We expect significant inflation in 2023 across our basket of input costs. Though we have seen some pullback in wheat futures from the highs, prices remain elevated.
In addition to flour, we're experiencing inflationary pressure in virtually all major categories of ingredients, packaging, and natural gas. Due to the timing of inflation in 2022, a significant portion of the inflationary costs will impact the first half of 2023. We anticipate mitigating those inflationary pressures through a combination of price increases and the efficiency initiatives that Ryals discussed. Approximately 60% of our key raw materials are covered in 2023. To minimize volatility and provide adequate visibility into cost, we have maintained our historical hedging strategy, buying and hedging six-12 months out. In fiscal 2023, we expect cost for the upgrade of our ERP system to be approximately $80 million-$90 million, $20 million-$30 million of which will be capitalized.
We anticipate the upgrade of our ERP system will cost in total approximately $350 million, of which approximately 32% is anticipated to be capitalized. We expect the upgrade to be completed in 2026. This amount exceeds our initial estimate of approximately $275 million, driven primarily by expanding the project scope as we move through the build phase and anticipation of greater reliance on external resources for implementation and bakery deployments due to labor constraints. As of December 31st, 2022, we have incurred costs related to the project of approximately $153 million. Our ERP program remains on track and we are confident in our ability to implement it as planned and within the updated financial guidance. Regarding earnings cadence, the first quarter will have the most difficult year ago comparisons due to our strong start in fiscal 2022.
Thank you, now I'll turn it back to Ryals.
Thank you, Steve. You've just heard details about our fourth quarter financial results and our financial expectations for fiscal 2023. Now I'd like to address some of the key factors impacting the current environment, including macroeconomic pressures, the consumer response to these pressures and competitive market dynamics in the bread category. The macroeconomic backdrop remains challenging as continuing inflationary pressures and recessionary fears have impacted consumer spending. Although unemployment remains low, recent signs point to an increase in layoffs as higher interest rates may be taking a toll on economic growth. On the other hand, as the Fed noted this week, stronger than expected job growth may cause inflation to be harder to tamp down. In response, some consumers are trading down to lower priced products and shifting more of their purchases to value-focused retailers.
For example, specialty premium bread lost 50 basis points of unit share in the quarter, more than any other category within fresh packaged bread. While the more economical white and soft variety loaf categories were among the largest share gainers, up 40 and 30 basis points respectively. The mass channel gained 130 basis points of unit share in the second half of 2022, while the grocery channel lost 170 basis points. In keeping with those trends, private label gained market share in the second half of 2022, although those gains plateaued towards the end of the year. In past quarters, we've discussed the divergence in results between the mass and grocery channels, and that phenomenon has continued.
Private label remains much stronger in the mass channel, where the price gap between private label and branded products is wider than in grocery, but flattened out toward the end of the year. In grocery, private label share gains remain muted and actually declined toward the end of the year. It's important to note that beginning in January, we've begun to see the mass channel implement price increases in private label. Price gaps remain wider than in grocery, but we interpret the move as a positive first step for the health of branded products.
Looking ahead to 2023, in addition to the effect of difficult comparisons in the first quarter due to Omicron and winter storms last year, we expect the big swing factors in our performance to be changes in inflation, consumer spending patterns, the competitive environment, and our ability to offset inflation with price increases and cost savings measures. Although these macro level trends are largely beyond our control, we are focused on proactively strengthening the controllable parts of our business in the current environment and beyond. Specific actions include affecting our portfolio strategy of shifting a greater percentage of our sales to higher margin branded products via innovation and advertising, and investing in capabilities like supply chain, our agile innovation team, and digital and ERP initiatives. These investments we're making in our business, innovation, marketing, supply chain, digital and ERP, are laying the foundation for our future growth.
As we've seen with our digital and ERP programs, upfront costs are required before the benefits flow through. We remain steadfast in our belief that these investments in our business will pay strong dividends in the future. While we're committed to maximizing our performance in the current environment, our focus is on long-term value creation. While we expect the macro environment to remain challenging in 2023, the Flowers team is nonetheless committed to pushing aggressively ahead and positioning ourselves to outperform in the future. Thank you very much for your time. This concludes our prepared remarks.