In Excel, LOG calculates a number’s logarithm; it does not record or save text messages. To build or edit log strings, use text functions such as TEXT, CONCAT, and TEXTJOIN. If you mean a permanent history of events, Excel formulas alone cannot append and preserve one: enter or import records as values, or use an appropriate automation or logging system.
What “LOG string functions” means in Excel
The phrase can refer to two different things. Excel’s LOG function is a mathematical function that returns a logarithm. Text functions, sometimes called string functions in programming, join, extract, format, or replace characters in text. There is no built-in Excel function named LOGSTRING that writes messages to a file or keeps a running event history.
A worksheet can still be useful for log data. A typical log is a table with one event per row and columns such as timestamp, severity, source, and message. Text formulas can assemble a readable line from those fields, while numeric formulas can analyze measurements recorded alongside them. Keeping the distinction clear avoids treating a calculated logarithm as though it were a text log.
What Excel’s LOG function calculates
LOG(number, [base]) returns the logarithm of a positive number in the specified base. If the base is omitted, Excel uses 10. For example, the base-10 logarithm of 1,000 is 3 because 10 raised to the third power equals 1,000. With 8 as the number and 2 as the base, the result is also 3.
With the number 1,000 in A2, this formula returns 3: =LOG(A2,10). With 8 in A3, =LOG(A3,2) returns 3. In both cases, the cells contain numbers, not strings. The input must be positive, and the base must be positive and cannot equal 1; invalid inputs produce an Excel error.
Excel also has LOG10(number) for base-10 logarithms and LN(number) for natural logarithms, whose base is the mathematical constant e. These functions are useful in calculations and data analysis, but none of them writes an event to a log. If a logarithmic result needs to appear inside a message, calculate it first or combine the calculation with text formatting.
Useful Excel text functions for log messages
Excel calls these features text functions in its function library. They operate on text values, although some can convert numbers or dates into text. The most useful choices depend on whether the goal is to assemble a full message, standardize an entry, or pull a piece out of an existing record.
CONCATjoins text or cell values together. The ampersand operator,&, is another straightforward way to join parts.TEXTJOINcombines multiple items with a chosen separator and can skip empty cells. It is handy for assembling fields without leaving repeated separators where fields are blank.TEXTformats a number or date as text, using a format code such as0.00for two decimal places oryyyy-mm-ddfor a date.LEFT,MID, andRIGHTreturn characters from the start, middle, or end of a string.LENcounts characters.TRIMremoves extra ordinary spaces, andSUBSTITUTEreplaces specified text. These can help normalize imported messages.
For example, with the text ERROR: disk full in A2, =LEFT(A2,5) returns ERROR. With server-17 | timeout in A3, =TEXTAFTER(A3,"| ") returns timeout. TEXTAFTER is available in Microsoft 365 and Excel 2024; for older perpetual versions, use a compatible combination of older text functions or work with the data in Power Query.
Build a readable log line from worksheet fields
It is usually easier to keep log information in separate columns and create a combined display string only when needed. For example, use column A for a fixed timestamp, column B for severity, and column C for the message. Keeping the source fields separate makes it simpler to filter by severity, sort chronologically, and correct a message without dissecting one long text value.
With a timestamp in A2, severity in B2, and message in C2, this formula creates a line with vertical bars between the fields: =TEXT(A2,"yyyy-mm-dd hh:mm:ss")&" | "&B2&" | "&C2. If A2 is 3 November 2026 at 09:15, B2 is INFO, and C2 is Import finished, the displayed result is 2026-11-03 09:15:00 | INFO | Import finished.
The TEXT call matters because date and time values are stored as numbers in Excel. Without formatting, a joined result may show an underlying serial value or an unexpected display. Choose a format that suits the people or systems that will read the log; an unambiguous year-month-day order can be helpful when records cross regional settings.
If the timestamp is generated with NOW(), remember that it is volatile: it can update when Excel recalculates the workbook. With severity in B2 and message in C2, =TEXT(NOW(),"yyyy-mm-dd hh:mm:ss")&" | "&B2&" | "&C2 shows the current time as part of the result, but does not freeze that time as a historical event. To retain the time of an event, record a fixed value by typing or pasting it as a value, or use a suitable controlled data-entry or automation process.
Join several fields and clean inconsistent text
When a log line has several fields, TEXTJOIN can make the formula easier to maintain than a long chain of ampersands. With a timestamp already formatted as text in A2, severity in B2, source in C2, and message in D2, =TEXTJOIN(" | ",TRUE,A2:D2) joins the four cells with a separator. The second argument, TRUE, tells Excel to ignore empty cells. If a field is blank, the result does not insert an empty field between two separators.
For an individual message, TRIM can remove leading and trailing spaces and reduce repeated ordinary spaces between words. With an imported message in C2, =TRIM(C2) returns a cleaned version in another cell; it does not alter C2 itself. This distinction is useful when the raw source should remain available for review.
Cleaning should not erase meaningful detail. A space may be part of a quoted message, and changing capitalization or punctuation can make two distinct records appear identical. Keep an untouched source column when data is important, then create a separate cleaned or display column. Also note that TRIM is aimed at ordinary space characters; data copied from web pages or other systems can contain nonbreaking spaces or other characters that need separate handling.
Can a formula create a permanent log?
No. A formula calculates a result from the current workbook state. It does not append a new row each time something happens, preserve a previous result after its inputs change, or write a record to an external file. A cell containing a formula with NOW() can look like a timestamped record, but recalculation may change the timestamp, so it is not a dependable audit trail.
For a simple manual log, create an Excel table with columns such as Date/time, Category, User or source, and Details. Enter each event as a new row, and store timestamps as fixed values. Tables make it easier to filter and sort as records grow. If records come from another application, import them as rows rather than relying on formulas to capture events that occur elsewhere.
For automated capture, the right option depends on where events originate and how durable or tamper-resistant the history must be. Power Automate or Office Scripts may help with supported workflows, while application logging, a database, or a managed monitoring service may be more appropriate for operational records. A worksheet is convenient for small, visible datasets, but it should not be mistaken for a secure, append-only system.
Common mistakes and practical checks
- Confusing a logarithm with a log record:
LOGreturns a numeric result; text functions create or manipulate text. Use the function suited to the data. - Expecting a formula to preserve history: formulas recalculate. Store event timestamps and messages as fixed records if they must remain unchanged.
- Leaving numbers and dates unformatted: joining a date or decimal directly into text may produce an unsuitable display. Apply
TEXTwith an intentional format where appropriate. - Using separators that also occur in messages: a message containing a vertical bar can make a delimited line hard to parse. Keep fields in separate columns, or choose a format with reliable escaping when exchanging data.
- Ignoring locale and time-zone meaning: date displays can vary by regional settings, and a spreadsheet time does not by itself document its time zone. Record the zone or use a consistent convention when records are shared across locations.
- Using a worksheet as an audit system: workbook contents can be edited, overwritten, or recalculated. Where accountability or retention matters, use a system designed for that purpose and follow applicable organizational requirements.
Choosing between formulas and other approaches
Use formulas when the goal is to format a view, concatenate fields, clean imported text, or calculate a numeric measure such as a logarithm. They are transparent and easy to inspect in a worksheet, and the underlying data can remain structured for filtering and analysis.
Use manually entered values or a controlled input process when you need a small, human-maintained history whose timestamps must not change. Use an import or data connection when another system already produces the records. For repeated or high-volume event capture, consider a logging feature in the source application or a database rather than constructing a text string in a cell. The appropriate choice depends on volume, who may edit the records, required retention, and whether the history needs to be independently verifiable.
Frequently Asked Questions
Is there a LOGSTRING function in Excel?
No. Excel has LOG for mathematical logarithms and separate text functions for working with strings. You can combine text fields into a log-style line, but there is no built-in LOGSTRING function that saves event history.
How do I combine a date, level, and message in Excel?
Keep the date, level, and message in separate cells, then use TEXT to format the date and & or TEXTJOIN to join the fields. Store the timestamp as a fixed value if it must not change when the workbook recalculates.
What is the difference between LOG and LOG10?LOG(number, base) accepts a chosen base, defaulting to 10 when the base is omitted. LOG10(number) always calculates the base-10 logarithm.
Does NOW() make a permanent timestamp?
No. NOW() returns the current date and time and can update when Excel recalculates. It is useful for showing the current time, but a fixed value or a purpose-built capture process is needed for an unchanged historical timestamp.
Can Excel formulas write log messages to a text file?
No. Worksheet formulas return results in cells; they do not write files or append records outside the workbook. Exporting data or automating file creation requires a separate feature or tool, chosen to suit the workflow and record-keeping requirements.
Related
- How to Calculate Mass Balance in Chemistry
- Excell Battery Corporation: What It Sells and How It Works
- Balance GraphQL API: Availability and Alternatives
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- IF Then Formula for Dates in Excel: Examples and FixesUse Excel’s IF function to test a date and return one result when the condition is true and…
- Excel Formula for Calculating Overtime HoursTo calculate daily overtime in Excel, subtract unpaid break hours and the regular-hours threshold from the shift length,…
- Excel Filter Remove Shortcut Keys: Clear or Toggle?In Excel for Microsoft 365 on Windows, press Ctrl+Shift+L to turn AutoFilter arrows on or off; to clear…
- Excel RIGHT Function Examples: Extract Text from the EndUse Excel’s RIGHT function to return characters from the end of a text value. For example, if A2…
- Excel SUMIFS Month and Year: Formula GuideTo sum values by month and year in Excel, use the SUMIFS function with two criteria: one that…
- How to Find the Lowest Number in Excel with MIN FormulaTo find the lowest number in a range, enter =MIN(A2:A20) in an empty cell, replacing A2:A20 with the…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.