Thetownend.com

80% => The Nevillew General Discussion Forum => Topic started by: Flashheart on Wednesday, September 5, 2012, 14:08:01



Title: Excel peeps
Post by: Flashheart on Wednesday, September 5, 2012, 14:08:01
This sounds like something that should have an easy answer, but I'm buggered if I can find it.

I have a formula in excel and I don;t want to have to type it in any time. How do I save it so I can just insert said formula into a cell whenever I need it.

Cheeeeeers



Title: Re: Excel peeps
Post by: @MacPhlea on Wednesday, September 5, 2012, 14:09:19
Just copy and paste it or drag it down through the cells...

If your formula includes a cell that is fixed in location (i.e. isn't relative to others then just preceed it with $ i.e. $A$3)

the other way os to create a macro button that inserts it when you click the button...


Title: Re: Excel peeps
Post by: Flashheart on Wednesday, September 5, 2012, 14:14:59
Well yeah.

But I want it to remain in excel even for use later on and in different workbooks. Excel already has formulas built in ready to use (sum, count etc). How do I make one of those myself? 


Title: Re: Excel peeps
Post by: Ginginho on Wednesday, September 5, 2012, 14:15:08
Are you familiar with macros?
You can do it as a macro, create a shortcut key (for example, ctrl, shft + Y) and save it in "new book", this will be available whenever you open a new sheet.


Title: Re: Excel peeps
Post by: Ginginho on Wednesday, September 5, 2012, 14:20:03
Click on record macro, give it a name and remember the shortcut key you choose.
Select "New book" in the "store macro in" field.
Highlight the text in the function text field, copy.

Done.

Open up a new workbook and do the shortcut key combo you chose, see if it worked?



Title: Re: Excel peeps
Post by: Flashheart on Wednesday, September 5, 2012, 14:20:46
Just tried to create a macro and managed to crash excel.

I'll crack it.


Title: Re: Excel peeps
Post by: Flashheart on Wednesday, September 5, 2012, 14:26:42
That image is different from mine, I'm using 2010 and don't get the 'Highlight the text in the function text field, copy.' option.

And boys are fantastic.


Title: Re: Excel peeps
Post by: jonny72 on Wednesday, September 5, 2012, 14:27:14
But I want it to remain in excel even for use later on and in different workbooks. Excel already has formulas built in ready to use (sum, count etc). How do I make one of those myself? 

They're called functions, not formulas.

You can create your own but you need to write them in VBA.

Plenty of tutorials on the interweb.


Title: Re: Excel peeps
Post by: Bewster on Wednesday, September 5, 2012, 14:27:44
You can also  set up a button on your tool bar and assign the macro to it


Title: Re: Excel peeps
Post by: Flashheart on Wednesday, September 5, 2012, 14:29:33
They're called functions, not formulas.

You can create your own but you need to write them in VBA.

Plenty of tutorials on the interweb.

Something else for me to never get around to doing then


Title: Re: Excel peeps
Post by: Ginginho on Wednesday, September 5, 2012, 14:33:35
Ignore my suggestion, i've just closed excel and reopened and tried it, and it didn't work.


Title: Re: Excel peeps
Post by: Bewster on Wednesday, September 5, 2012, 14:35:35
Ignore my suggestion, i've just closed excel and reopened and tried it, and it didn't work.

You need to save it in a hidden work book that sits behind excel.


Title: Re: Excel peeps
Post by: Bewster on Wednesday, September 5, 2012, 14:38:58
When you record the macro you have to save it in the personal macro workbook.



Title: Re: Excel peeps
Post by: Flashheart on Wednesday, September 5, 2012, 14:55:44
Is visual basic the same language as when creating the formula (it looks as though it may be), or would I have to learn a new computing language?

This strikes me as something that should really be much, much, much simpler.


Title: Re: Excel peeps
Post by: Flashheart on Wednesday, September 5, 2012, 14:56:32
When you record the macro you have to save it in the personal macro workbook.



But nothing happens


Title: Re: Excel peeps
Post by: jimmy_onions on Wednesday, September 5, 2012, 14:59:23
Dunno if you can do this in excel, but in Mathcad, I have a standard template file which opens up when ever I open up a new work book (instead of just a blank one). I have all the eqns in there i need.

Is there such a thing as a excel templte file - if so, could you just stick your formula (sorry Jonny, function) in there?


Title: Re: Excel peeps
Post by: Bewster on Wednesday, September 5, 2012, 15:01:04
Have you assigned a shortcut key ?


Title: Re: Excel peeps
Post by: Flashheart on Wednesday, September 5, 2012, 15:16:08
Sorted. Cheers peeps.

I'm going to get flash now and give it it's own button on the toolbar.


Title: Re: Excel peeps
Post by: jimmy_onions on Wednesday, September 5, 2012, 15:18:37
just out of curiousity, what is the said eqn?


Title: Re: Excel peeps
Post by: Flashheart on Wednesday, September 5, 2012, 15:22:37
just out of curiousity, what is the said eqn?

Quote
=LEN(F6)-LEN(SUBSTITUTE(F6," ",""))+1

It counts the number of words in a cell. Excel has no word count function so a formula has to be used instead.


Title: Re: Excel peeps
Post by: jonny72 on Wednesday, September 5, 2012, 16:18:30
Is visual basic the same language as when creating the formula (it looks as though it may be), or would I have to learn a new computing language?

This strikes me as something that should really be much, much, much simpler.

VBA code to perform a word count here;

http://www.cpearson.com/excel/wordcount.htm

You'll just need to figure out how to make it available to every spread sheet. Again, Google is your friend.


Title: Re: Excel peeps
Post by: Bewster on Wednesday, September 5, 2012, 18:37:31
It counts the number of words in a cell. Excel has no word count function so a formula has to be used instead.

Every day is a school day - didn't know that. Cheers Flash


Title: Re: Excel peeps
Post by: Jimmy Glass is an Alien on Monday, November 19, 2012, 18:25:09
Evening.

Is there anyway I can create a formula that when I colour a cell it adds the coloured cells up and totals them in a formula?

I want each cell to have a value of 0.5 and when I colour it green to total up for me.

Thanks in advance.


Title: Re: Excel peeps
Post by: @MacPhlea on Monday, November 19, 2012, 18:55:42
Evening.

Is there anyway I can create a formula that when I colour a cell it adds the coloured cells up and totals them in a formula?

I want each cell to have a value of 0.5 and when I colour it green to total up for me.

Thanks in advance.


My first question would be... What criteria are you using to determine if it is green... If you can answer that question and it uses a standard formula then simply use that to trigger the inclusion... It'll save you the hassle of manually changing it to green each time.

Better still, chuck excel in the bin and build a database... Read this and you'll understand why I say that...

http://theitpartner.blogspot.co.uk/2012/11/spreadsheet-paralysis.html


Title: Re: Excel peeps
Post by: Bewster on Monday, November 19, 2012, 19:48:58
You can filter by colour in excel and then sum that.

What I would do is in a hidden column put an "IF" statement that would return the a value if it falls in the set criteria and then use "sumif"

Let assume the the range that maybe green is D1:D10

So in your example in e1 put =if( d1= 0.5, "y", "n"), copy this down from e1 to e10.  then in your total put =Sumif(E1:E10, "y", D1:D10)

So if the value in e1:e10 = "y", then sum the corresponding vlaue in D1:D10. Make sense ?


Title: Re: Excel peeps
Post by: jonny72 on Monday, November 19, 2012, 20:13:32
Good article telling you everything you need to know about Excel colour functions here;

http://www.cpearson.com/excel/colors.aspx