Solved

# excel formula question

Posted on 2011-03-18
179 Views
I was given this formula to merge a date and a time column into one column. The time column did not have a space between the time and am/pm. The formula works perfectly. The formula is:=B8+REPLACE(C8,LEN(C8)-1,0," "). My question is: Why is it -1 instead of -2, As an example the time column contains 7:30am. I just want to understand how this works.
0
Question by:qbjgqbjg
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• Learn & ask questions
• 2

LVL 81

Expert Comment

ID: 35167842
The function is evaluated as follows:

REPLACE(C8,LEN(C8)-1,0," ")
REPLACE(C8,6-1,0," ")
REPLACE(C8,5,0," ")

Which inserts a space before the AM or PM thus allowing the time to be properly interpreted.

Kevin
0

LVL 81

Accepted Solution

zorvek (Kevin Jones) earned 500 total points
ID: 35167852
Note that the third parameter to the REPLACE function is the character position BEFORE which the text is to be inserted/replaced.

Kevin
0

Author Closing Comment

ID: 35167880
That explains it. Thanks so much.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

### Suggested Solutions

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
###### Suggested Courses
Course of the Month4 days, 2 hours left to enroll

#### 751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.