Starter macros

123 ready-made Excel macros

Every one is built from MacroRoni's tested steps, explained in plain English, and ready to adjust to your sheet. Open any of them in MacroRoni's Starter gallery.

Clean up

Clean upTidy a messy listTrim spaces, remove hidden characters, delete empty rows and duplicates, then fit the columns.Changes data · backup onClean upFix numbers stored as textTurn numbers typed as text back into real numbers so totals and sorting work.Changes data · backup onClean upStandardize namesTrim spaces and capitalize each word in a column of names.Changes data · backup onClean upFill the gapsWrite N/A into empty cells so missing values are easy to spot and count.Changes data · backup onClean upSplit full namesSplit "First Last" in column A into separate columns starting at B.Changes data · backup onClean upFill down grouped labelsCopy each label in column A down into the empty cells below it, so every row says which group it belongs to.Changes data · backup onClean upRemove empty columnsDelete columns that have nothing in them, then fit the rest.Changes data · backup onClean upTrim spaces everywhereRemove extra spaces and hidden characters from every cell in the sheet.Changes data · backup onClean upClean up phone numbersStrip brackets, dashes, dots and spaces from phone numbers in column B, keeping only the digits.Changes data · backup onClean upTidy email addressesTrim spaces and make every email address in column C lowercase.Changes data · backup onClean upFix ALL CAPS namesTurn names typed in capitals in column A into Title Case.Changes data · backup onClean upRemove dashes from IDsTake the dashes out of IDs or account numbers in column A.Changes data · backup onClean upClear N/A placeholdersFind every “N/A” typed into the sheet and remove it, leaving the cell empty.Changes data · backup onClean upRound amounts to centsRound the amounts in column B to 2 decimal places and show them as currency.Changes data · backup onClean upClean up an imported reportFor pasted data: remove hidden characters and spaces, fix text numbers, delete empty rows and columns.Changes data · backup onClean upRemove duplicate emailsTidy the emails in column C, then delete rows whose email is already listed.Changes data · backup onClean upStrip all formattingRemove colors, fonts and borders so the data is plain again, then fit the columns.Changes data · backup onClean upMake Yes/No answers consistentTurn y, Y, yes, true and similar answers in column D into exactly “Yes” or “No”.Changes data · backup onClean upMake a place name the same everywhereChange NY, N.Y. and NYC in column C to “New York”. Edit the spellings for your own data.Changes data · backup on

Text & IDs

Text & IDsAdd leading zeros to IDsMake every ID in column A six characters long, like 000123, and keep the zeros.Changes data · backup onText & IDsFix ZIP codes that lost their zeroExcel drops the leading zero from ZIP codes like 02134. Put it back in column E.Changes data · backup onText & IDsGet the domain from emailsWrite the part after @ (the company domain) from column C into column D.Changes data · backup onText & IDsTurn emails into user namesWrite the part before @ from column C into column D.Changes data · backup onText & IDsPull out first namesWrite the first word of each full name in column A into column B.Changes data · backup onText & IDsPull out last namesWrite the last word of each full name in column A into column C.Changes data · backup onText & IDsMake initialsWrite initials (like JS for Jane Smith) from the names in column A into column B.Changes data · backup onText & IDsJoin first and last namesPut first names (A) and last names (B) together with a space in column C.Changes data · backup onText & IDsPut a prefix on every IDAdd “INV-” in front of each value in column A. Change the prefix to suit.Changes data · backup onText & IDsMask account numbersKeep only the last 4 characters of each value in column B and hide the rest with ****.Changes data · backup onText & IDsCount charactersWrite the length of each value in column A into column B, to spot text that is too long.Changes data · backup onText & IDsTidy product codesMake product codes in column A uppercase with no spaces.Changes data · backup on

Reports

ReportsMake a report look professionalDark header row, banded rows, borders, frozen header and fitted columns.Doesn't change valuesReportsPrint-ready reportLandscape on one page wide, header repeated on every page, page numbers in the footer.Doesn't change valuesReportsSave the sheet as a PDFFit the sheet to the page and save it as a PDF next to the workbook.Doesn't change valuesReportsExport to CSVSave the current sheet as a CSV file for other systems.Doesn't change valuesReportsMonthly report layoutHeader, banded rows, borders, currency in column C, frozen header and landscape page.Doesn't change valuesReportsTurn the list into a tableMake A1:H500 an Excel table with filter buttons and banded rows.Doesn't change valuesReportsAdd data bars to amountsShow a bar in each amount cell in column C so big and small values stand out at a glance.Doesn't change valuesReportsColor-code numbers (heat map)Color the numbers in B2:F500 from red (low) through yellow to green (high).Doesn't change valuesReportsClean dashboard lookHide gridlines, style the header, use a modern font and zoom out a little.Doesn't change valuesReportsQuick stats boxWrite the total, average, largest and smallest of column B into a small box at H1:I4.Changes data · backup onReportsTop 10 reportSort by column B from highest to lowest and highlight the top 10.Changes data · backup onReportsSort by date, newest firstSort the table by the dates in column C so the most recent rows are at the top.Changes data · backup onReportsSort by name A to ZSort the table alphabetically by column A.Changes data · backup onReportsSort by region, then nameGroup rows by the region in column C, then sort names within each region.Changes data · backup onReportsReady for reviewStyle the header, freeze the top row and first column, and fit the columns.Doesn't change valuesReportsMake a sheet easier to readLarger text, wrapped and top-aligned cells, and rows that fit their contents.Doesn't change values

Highlight

HighlightHighlight overdue itemsColor the whole row red when the date in column F is in the past.Doesn't change valuesHighlightFlag what's due this weekColor rows yellow when the date in column F is within the next 7 days.Doesn't change valuesHighlightSpot large amountsColor amounts over 1,000 in column B green.Doesn't change valuesHighlightFind duplicates and missing cellsColor repeated IDs in column A and every empty cell, without changing any values.Doesn't change valuesHighlightHighlight the top 10Fill the 10 highest numbers in column B green. It updates when the numbers change.Doesn't change valuesHighlightHighlight the 5 lowestFill the 5 lowest numbers in column B red.Doesn't change valuesHighlightHighlight negative numbersFill every number below zero in B2:F1000 red.Doesn't change valuesHighlightFlag zero amountsFill amounts that are exactly 0 in column B yellow.Doesn't change valuesHighlightHighlight a keywordFill every cell that mentions “urgent” (in any capitals). Change the word to suit.Doesn't change valuesHighlightHighlight weekend datesFill dates in column A that fall on a Saturday or Sunday.Doesn't change valuesHighlightFlag amounts over budgetFill amounts over 1,000 in column C red. Change the limit to your budget.Doesn't change valuesHighlightHighlight low stockFill stock levels of 10 or fewer in column D orange so you know what to reorder.Doesn't change valuesHighlightHighlight repeated IDsFill IDs in column A that appear more than once.Doesn't change valuesHighlightHighlight missing valuesFill every empty cell in the data so gaps are easy to see.Doesn't change valuesHighlightColor-code scoresColor the scores in column B from red (low) to green (high).Doesn't change valuesHighlightGray out finished rowsFor each row whose status in column E is “Done”, fill the row gray.Doesn't change valuesHighlightHighlight rows due in 3 daysFill the whole row when the date in column F is within the next 3 days.Doesn't change valuesHighlightFlag items older than 30 daysFill dates in column F that are more than 30 days ago.Doesn't change valuesHighlightHighlight expired datesFill the whole row when the expiry date in column D has passed.Doesn't change valuesHighlightFind TBD placeholdersFill every cell that still says “TBD” so nothing unfinished slips through.Doesn't change values

Calculations

CalculationsAdd a totals rowAdd a bold total under column B and show it as currency.Changes data · backup onCalculationsRunning totalAdd a running total of column B in column C.Changes data · backup onCalculationsCount and total one categoryCount the rows where column A says Sales and add up their amounts from column B.Changes data · backup onCalculationsPercent of totalShow what share of the column B total each row is, in column D.Changes data · backup onCalculationsPercent changeCompare this period (C) with last period (B) and show the change as a percent in D.Changes data · backup onCalculationsProfit marginWork out the margin from price (B) and cost (C) as a percent in column D.Changes data · backup onCalculationsAdd sales taxWork out 7% tax on the amounts in column C and write it in column D. Change 0.07 to your rate.Changes data · backup onCalculationsApply a discountWrite the price after a 10% discount next to each price in column B.Changes data · backup onCalculationsWork out commissionWork out 5% commission on the sales in column B, in column C.Changes data · backup onCalculationsRank from highest to lowestGive each value in column B its rank (1 = highest) in column C.Changes data · backup onCalculationsTurn scores into letter gradesTurn the scores in column B into A, B, C, D or F in column C.Changes data · backup onCalculationsTotal each rowAdd up columns B to F on every row and write the total in column G.Changes data · backup onCalculationsAverage each rowAverage columns B to F on every row and write it in column G.Changes data · backup onCalculationsPass or failWrite Pass when the score in column B is 60 or more, and Fail otherwise, in column C.Changes data · backup onCalculationsAdd 20% VATWrite the price including 20% VAT next to each net price in column B.Changes data · backup onCalculationsMonthly loan paymentA small calculator: type the rate, years and amount in B1:B3 and see the monthly payment in B4.Changes data · backup onCalculationsCount the filled rowsWrite how many rows have something in column A into E1.Changes data · backup onCalculationsQuantity times priceMultiply quantity (B) by price (C) into column D and add a grand total at the bottom.Changes data · backup onCalculationsConvert kilometers to milesWrite the miles for each distance in kilometers (column B) into column C.Changes data · backup on

Dates & time

Dates & timeAge from date of birthWork out each person's age in years from the birth dates in column B, in column C.Changes data · backup onDates & timeDays until dueCount the days from today until each due date in column C, in column D.Changes data · backup onDates & timeDays overdueShow how many days each due date in column C is late (0 if not late), in column D.Changes data · backup onDates & timeMonth name from a dateWrite the month (January, February…) of each date in column A into column B.Changes data · backup onDates & timeDay of the weekWrite the weekday (Monday, Tuesday…) of each date in column A into column B.Changes data · backup onDates & timeQuarter from a dateWrite Q1, Q2, Q3 or Q4 for each date in column A into column B.Changes data · backup onDates & timeYear from a dateWrite the year of each date in column A into column B, ready for grouping.Changes data · backup onDates & timeWorking days between datesCount the weekdays between the start (B) and end (C) dates in column D.Changes data · backup onDates & timeHours workedWork out the hours between the start (B) and finish (C) times in column D.Changes data · backup onDates & timeStamp today's dateWrite “Updated” and today's date at the top of the sheet.Changes data · backup onDates & timeEnd of the monthWrite the last day of the month for each date in column A into column B.Changes data · backup onDates & timeShow dates the same wayShow every date in column C as mm/dd/yyyy, centered.Doesn't change values

Sheets & safety

Workbook tools