Solved

excel formula question

Posted on 2011-03-18
3
175 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
  • 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now