The Book-keepers Forum (BKF)

Post Info TOPIC: Excel Formula


Forum Moderator & Expert

Status: Offline
Posts: 11981
Date:
Excel Formula
Permalink Closed


Hypothetically yes... sort of (see corrected formulae below) But... each cell is defined as a smallint so you can fit a maximum of 32,767 characters in a cell.

I can't imagine that you are likely to breach that but it's just a bit of extra info.

To save you going in and changing the cells as your criteria changes it might be a good idea to point to value fields rather than specific items so rather than saying 8.25, 7.25 etc. point to a set of fields.

For example, just a simple case but I would include at least 10 options.

Column A1 : 7.25

Column A2 : 8.25

In the formulae that you have :

COUNTIF(AC18:AC30,a1)+COUNTIF(AC18:AC30,a2)

string 10 of those together and for any cell that you don't need to count enter the word NULL (or anything else that you fancy) in the search cell.

HTH,

Shaun.

 

p.s. just thought to mention. When you are refering to cells rather than values the reference should not be in quotes



-- Edited by Shamus on Wednesday 16th of January 2013 12:37:33 PM

__________________

Shaun

Responses are not meant as a substitute for professional advice. Answers are intended as outline only the advice of a qualified professional with access to all relevant information should be sought before acting on any response given.



Expert

Status: Offline
Posts: 1609
Date:
Permalink Closed

Is there a way to count the number of cells in a column based on colur. I can't seem to find a formula that works.



__________________
Steve


Forum Moderator & Expert

Status: Offline
Posts: 11981
Date:
Permalink Closed

Not as far as I know.

Unless you fancy learning Visual Basic for Applications your best bet may be to look at the condition that set the colour in the first place and as well as setting the colour add an indicator in another, none displayed column and then the count sums the entries in the column that have something in them.

Sorry the answers not what you are looking for,

kind regards,

Shaun.



__________________

Shaun

Responses are not meant as a substitute for professional advice. Answers are intended as outline only the advice of a qualified professional with access to all relevant information should be sought before acting on any response given.



Forum Moderator & Expert

Status: Offline
Posts: 11981
Date:
Permalink Closed

Ooh, that appeared straight away... Wonder if that means that the site is now fixed?


__________________

Shaun

Responses are not meant as a substitute for professional advice. Answers are intended as outline only the advice of a qualified professional with access to all relevant information should be sought before acting on any response given.



Expert

Status: Offline
Posts: 1609
Date:
Permalink Closed

Hi Shaun, everywhere points to as you say using VBA. Is it possible to use a count formula to just count cells ina range that have data in them, so some will have 8.25 and sum will have 7.75, I just want to know how many in a column have just this data in.

__________________
Steve


Forum Moderator & Expert

Status: Offline
Posts: 11981
Date:
Permalink Closed

Yes.

Count a specific value : =COUNTIF(AC18:AC30,">0") the criteria must be in quotes so in your example that could be "=8.25"

Count non blank cells : =COUNTA(AC18:AC30)

hope that helps,

Shaun.

__________________

Shaun

Responses are not meant as a substitute for professional advice. Answers are intended as outline only the advice of a qualified professional with access to all relevant information should be sought before acting on any response given.



Expert

Status: Offline
Posts: 1609
Date:
Permalink Closed

Thanks Shaun, I should be able to use as many criteria as I like in one formula shouldn't I? IE =COUNTIF(AC18:AC30,"8.25",(AC18:AC30,"7.75")) or there or thereabouts.

__________________
Steve


Expert

Status: Offline
Posts: 1609
Date:
Permalink Closed

Thats perfect thanks Shaun. I have a spread sheet where in a column I can put each days hours per person and it will calculate the weekly gross dependant on what hourly rate is in a particular cell. Holidays are in a column next to normal work hours and I just want it to give me a running total of holidays taken without having to manually count the days, this is where the colour comes in as all the holiday and bank holiday entries were in a coloured cell and I wanted to count them, counting the cells in a column with a value performs a similar task.

Thanks again.

__________________
Steve


Expert

Status: Offline
Posts: 1609
Date:
Permalink Closed

Stardoe wrote:

This probably won't help you Steve, but I have a VBA module that sums the figures in a range of cells based on their colour. If anyone is interested?


I'm interested please smile

 

I did find these online, however i havent a clue what to do with them confuse It appears you have to put this script in somewhere and that allows you to look for colours but how/where do you put the script in in the first place evileye



-- Edited by Rhianrach on Thursday 17th of January 2013 06:31:55 PM

__________________
Steve


Guru

Status: Offline
Posts: 1470
Date:
Permalink Closed

Hi Steve,

If you like I can send you an Excel workbook with the VBA module already in it.  Trouble is it will be an Excel 2003 spreadsheet (as I'm behind the times), so if you're using 2007 or 2010 not sure it will work, but it might.

In 2003 you open a new workbook, go to the Tools menu - Macro - Visual Basic editor.  In the Project - VBA Project box on the left hand side there will be a list of the sheets in the workbook and also This Workbook.  If you right click on This Workbook - Insert - Module, a Module box appears in the main window.  

This is where the code for the Sumcolor function is pasted.  You then save it as whatever you want the workbook to be called and close the VBA window.  You are then left with the Excel workbook which contains the code for the function.

To use the function in the workbook the formula is =sumcolor(K1,(range of cells)).  You will have to create a cell (in this case K1, but can be any cell you choose) with the particular colour in it first.  Then you highlight the range of cells you wish to sum and press enter. Oh, and there must be a comma after the K1 before highlighting the cell range.

You can also use Insert - Function from the Toolbar and it will appear in the User defined category in the "Or select a category" box.

The only drawback with this function is that once you have highlighted the cells with the colour you have to press Ctrl + Alt + F9 to refresh it.  It doesn't add up automatically as you enter the colour.

As I said, these instructions are for Excel 2003, but it must be similar in 2007/2010.  

I have attached a Word document with the code in it.  All you have to do is to copy it and then paste it into the VBA module.

Just read all this back before posting.....sounds complicated!!  If you wish me to email you a workbook with it already in, please let me know.  

Happy experimenting!

 

Edit:  To adjust formatting.



-- Edited by Stardoe on Thursday 17th of January 2013 08:32:12 PM

Attachments
__________________

Pauline



Guru

Status: Offline
Posts: 1470
Date:
Permalink Closed

This probably won't help you Steve, but I have a VBA module that sums the figures in a range of cells based on their colour. If anyone is interested?



__________________

Pauline



Expert

Status: Offline
Posts: 1609
Date:
Permalink Closed

I,ll have a look thanks. It is 2007 I use so I will see what happens :)

Thanks again.

__________________
Steve


Guru

Status: Offline
Posts: 1470
Date:
Permalink Closed

No probs Steve....let me know how you get on.

__________________

Pauline

Page 1 of 1  sorted by
 
Quick Reply

Please log in to post quick replies.

Tweet this page Post to Digg Post to Del.icio.us
Members Login
Username 
 
Password 
    Remember Me  
©2007-2024 The Book-keepers Forum (BKF). All Rights Reserved. The Book-keepers Forum (BKF) is a trading division of Bookcert Ltd. Registered in England Company Number 05782923. 2 Laurel House, 1 Station Rd, Worle, Weston-super-Mare, North Somerset, BS22 6AR, United Kingdom. The Book-keepers Forum and BKF are trademarks of Bookcert Ltd. This forum is a discussion forum only. There will usually be more than one opinion to any question and any posting should not be viewed as a definitive solution. No responsibility for loss occasioned to any person acting or refraining from action as a result of any posting on this site is accepted by the contributors or The Book-keepers Forum. In all cases, appropriate professional advice should be sought before making a decision. We reserve the right to remove any postings which are offensive, libellous, self-promoting or engaged in covert marketing. We will not notify users of removals. The views expressed in the forum posts are those of the individual and do not necessary reflect or agree with those of The Book-keepers Forum. Any offensive or unsuitable posts will be removed by the moderators. Any reader of this forum can request for a post to be looked into by sending an email to: bookcertltd@gmail.com.

Privacy & Cookie Policy  About