AgTalk Home
AgTalk Home
Search Forums | Classifieds (53) | Skins | Language
You are logged in as a guest. ( logon | register )

excel formula
View previous thread :: View next thread
   Forums List -> Computer TalkMessage format
 
Omar
Posted 9/21/2008 07:43 (#465522 - in reply to #465395)
Subject: Re: excel formula


Elmira, Ontario

I'm presuming you actually have a life!

I'll break that other formula up a bit for you.

=INT((B2-A2)*24)&" hrs, "&ROUND(((B2-A2)*24-INT((B2-A2)*24))*60,0)&" Min"

The INT function tells Excel to only look at the integer portion of a number, in this case hours (8 instead of 8.5). I had to use it in the second half of the formula as well to determine how much of the original amount WASN'T hours. Total minus integer leaves decimal portion.

The ROUND function was used because the calculation of the minutes didn't round trip to decimals and back to minutes without a lot of decimal places.

The "&" symbol tells Excel to start building a "sentence", more accurately a string of characters. As soon as Excel sees that, it knows the answer has to be text so it calculates the individual formulas and then puts the answers together as text.

Anything that Excel sees inside double quotes is treated as text and Excel doesn't calculate anything, just displays it.

Say A1 has a number in it. You can build the following text in A2 like such:

"You have failed to do this task "&a1&" times. Better try again."

Like IF statements, once you "get" text, it actually comes quite easily. Before Excel came along, we used to have to use the CONCATENATE function to build text. I don't think enough people could remember how to spell that though. It went like this:

=CONCATENATE("You failed ",a1," times.")

With this layout, it might be easier to visualize what is going on.

I don't use the Time stuff at all in my work, but I use the DATE functions constantly. I get amazed sometimes at how Excel is able to figure out year, month, day, hour, minute, seconds from 38,138.934538 or whatever.

The main place I use the text conversion is to allow me to put two things in one cell in a report. Sometimes, it just looks better to have the label and the answer together in one cell.

Top of the page Bottom of the page


Jump to forum :
Search this forum
Printer friendly version
E-mail a link to this thread

(Delete cookies)