Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

If Statement-If cell A1 is True, add 1 to value of cell A2

Im trying to make an If statement that will work like this:


If Cell A1 is true, add 1 to the number in Cell A2.


I am trying to track the number of times a specific number shows up using RANDBETWEEN. So if the result is 1, I want it to add to a counter, showing how many times that number has appeared. Is there a way to do this, how would it be done?

MacBook Air, iOS 11.1.2

Posted on Dec 11, 2017 10:45 AM

Reply
Question marked as Best reply

Posted on Dec 11, 2017 12:12 PM

you can do something like this:

User uploaded file

The table on the left, named "Data", contains a set of data generated with randbetween(0, 10)


The table on the right, named "Stats" is constructed as follows:

make the first row a header row

select cell A2, then enter the formula:

=row()-2


now select cell B2 and enter the formula:

=COUNTIF(Data::A:E, A2)


to fill down, select cells A2 and B2, copy

select cells A2 thru the end of column B, paste




if you want to plot a histogram of the data, then select column A of table "Stats", then select the contextual menu item from the men for column "A" (hover the cursor over the "A" and single click the down-facing arrow, then select convert to header column)

User uploaded file


now select cells B2 thru the end of column B, then select the bar chart from the charts menu:

User uploaded file User uploaded file

User uploaded file

3 replies
Question marked as Best reply

Dec 11, 2017 12:12 PM in response to Dsx-Kalista

you can do something like this:

User uploaded file

The table on the left, named "Data", contains a set of data generated with randbetween(0, 10)


The table on the right, named "Stats" is constructed as follows:

make the first row a header row

select cell A2, then enter the formula:

=row()-2


now select cell B2 and enter the formula:

=COUNTIF(Data::A:E, A2)


to fill down, select cells A2 and B2, copy

select cells A2 thru the end of column B, paste




if you want to plot a histogram of the data, then select column A of table "Stats", then select the contextual menu item from the men for column "A" (hover the cursor over the "A" and single click the down-facing arrow, then select convert to header column)

User uploaded file


now select cells B2 thru the end of column B, then select the bar chart from the charts menu:

User uploaded file User uploaded file

User uploaded file

Dec 11, 2017 2:58 PM in response to Dsx-Kalista

Hi Kalista,


You wrote:

"Im trying to make an If statement that will work like this:


If Cell A1 is true, add 1 to the number in Cell A2."


Wayne has solved the issue of how to get the end result you want. This is just a note on why he didn't make it "work like this".


Formulas determine the value in the cell containing the formula, so your formula would have to be placed in A2


It would look like this: User uploaded file


And it would return an error message:User uploaded file


It says "This formula," but the message is true of ALL formulas. In Numbers, self-reference is not permitted.


Something to tuck away in memory for future use.


Regards,

Barry

If Statement-If cell A1 is True, add 1 to value of cell A2

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.