Solved

excel formula question

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

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…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
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.

828 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