Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.

Get a Professional Answer

Via email, text message, or notification as you wait on our site. Ask follow up questions if you need to.

100% Satisfaction Guarantee

Rate the answer you receive.

Ask John D Your Own Question

John D, Bachelor's Degree

Category: Microsoft Office

Satisfied Customers: 9666

Experience: Bachelor of Science - Engineering Consultant

53785

Type Your Microsoft Office Question Here...

John D is online now

In MS Excel, is there a way to count the number of times a

Customer Question

In MS Excel, is there a way to count the number of times a particular value occurs in each cell of a given array of cells which is updated through a number of iterations?

I have a macro that runs a given scenario a number of times with a volatility variable which causes each cell in the given array to either register a zero or a one for each iteration of this scenario and I want to count the number of times a one occurs in each cell of that array.

Each iteration of the macro will write over the previous iteration value in each cell of the referenced array.

would you be able to upload the file at all as that may be easiest to work from?

Steve Herrod :

if you go to wikisend.com and choose upload

Steve Herrod :

you can upload the file and it will give you a link I can use to access

Steve Herrod :

Cheers

Steve Herrod :

Steve

Customer :

Hi Steve...I uploaded the file on Wikisend, after cleaning-up confidential information. The file number is XXXXX

Open the file to the "Main" sheet. "Hit" the keys "Cntrl" and "X" to initiate the macro. For every iteration of the macro, the array of cells at the bottom of the sheet will update with a 1 or a 0. I would like to accumulate the total number of 1's for each cell in the array from the start of the macro through its completion.

...make any sense?

Thanks!

Don

Steve Herrod :

thanks - checking that now!

Steve Herrod :

cheers

Steve Herrod :

Steve

Steve Herrod :

Hi Don,

Steve Herrod :

Steve Herrod :

Have been looking through various options to get this working but haven't been able to and will be away from laptop over next day or so on a project so I will open this to other experts in the meantime

Steve Herrod :

they will be able to see the details and the file link as well

Steve Herrod :

if no-one has responded I'll pick this up when back online properly late Thursday/Friday

Hi, I’m a moderator for this topic. It seems the professional has left this conversation. This happens occasionally, and it's usually because the professional thinks that someone else might be a better match for your question. I've been working hard to find a new professional to assist you right away, but sometimes finding the right professional can take a little longer than expected.

I wonder whether you're OK with continuing to wait for an answer. If you are, please let me know and I will continue my search. If not, feel free to let me know and I will cancel this question for you. Thank you!

There are 43 cells at the bottom of the Main sheet (highlighted in red), for which I want to count the total number of 1's that occur in each of these cells, from the start of the macro through the end.

It really doesn't matter where these totals are stored, but anywhere below the 43 cells at the bottom should be fine.

The macros should not be a factor in determining the count of the 43 cells, though I am looking for a way to count the total the number of times each cell of the 43 cells has a value of 1, from the start of the macro through the end.

Thank you for your patience, your business is very important to us, we are waiting on the Professional with the right expertise to come online. Feel free to let us know if you would like us to continue searching for a Professional or if you would like us to close your question. Thank you for your understanding!

Hello my name is XXXXX XXXXX I will gladly try to assist you with your question.

It sounds as if your needing to use the COUNTIF Function which will count a particular variable that you choose.

Here is an example:

=COUNTIF(A1:A43,0)

=COUNTIF(A1:A43,1)

The first countif will result in the number of times a 0 is within that range and the second one will result in the number of times a 1 is within that range.

Obviously, the only thing you will need to edit in that function is the cell range since I do not know exactly what range your data is in.

This will give me the count of a single iteration, but I'm looking for a way to accumulate these counts, for each cell in the array of cells, over 800 iterations. After each iteration this array of cells gets written over by the next iteration...the crux of the problem.

I understand. That can be accomplished writing VBA code into the workbook. I will opt out for a VBA coding expert to assist you. This question may be better suited in the Programming category.

Hi, I’m a moderator for this topic. It seems the professional has left this conversation. This happens occasionally, and it's usually because the professional thinks that someone else might be a better match for your question. I've been working hard to find a new professional to assist you right away, but sometimes finding the right professional can take a little longer than expected.

I wonder whether you're OK with continuing to wait for an answer. If you are, please let me know and I will continue my search. If not, feel free to let me know and I will cancel this question for you. Thank you!

MultFCalcs is triggered by "CNTL X" and runs a subroutine called FCalcs which does 100 iterations of calculations. The subroutine is called 8 times for a total of 800 iterations.

The other subroutines are for protecting and unprotecting the spreadsheets and are unrelated.

Customer:replied 4 years ago.

MultFCalcs is triggered by "CNTL X" and runs a subroutine called FCalcs which does 100 iterations of calculations. The subroutine is called 8 times for a total of 800 iterations.

The other subroutines are for protecting and unprotecting the spreadsheets and are unrelated.

After each iteration of FCalcs, I would like to keep a running total of 1's in each of the cells in the array of cells (highlighted in red) at the bottom of the Main sheet.

MultFCalcs should initialize this array of cells (to 0's) and the summation in each of the cells should continue throug the end of MultFCalcs and the total count for each cell should be displayed either in the same array or in a new array of cells just below.

I have been working on this for some time now and have created routines to count the number of times during the execution of the macro when each of the red cells changes to 1 or 0 but the FCalcs macro does not seem to have any effect on these red cells (the cell values are not changing to 1's and 0's and hence there is nothing that gets counted)

At this point I think I will opt out as I can invest more of my time on this just trying to understand the problem

Hi, I’m a moderator for this topic. It seems the professional has left this conversation. This happens occasionally, and it's usually because the professional thinks that someone else might be a better match for your question. I've been working hard to find a new professional to assist you right away, but sometimes finding the right professional can take a little longer than expected.

I wonder whether you're OK with continuing to wait for an answer. If you are, please let me know and I will continue my search. If not, feel free to let me know and I will cancel this question for you. Thank you!