Solved

excel formula question

Posted on 2011-03-18
3
180 Views
Last Modified: 2012-05-11
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
Comment
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
3 Comments
 
LVL 81

Expert Comment

by:zorvek (Kevin Jones)
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

by:
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

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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
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 will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

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

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

Join & Ask a Question