[Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register]

Author Message
JERRYC
General User

Joined: 26 Jun 2011
Posts: 8

 Posted: Sun Jun 26, 2011 10:38 am    Post subject: USING COUNTIF ENTER 6 IN B9 ENTER 5 IN B10 ENTER 4 IN B11 ENTER 3 IN B12 FORMULA: =COUNTIF(B12;"
Ed
Super User

Joined: 28 May 2003
Posts: 1040

Posted: Sun Jun 26, 2011 11:21 am    Post subject:

Why use COUNTIF with a range of only one cell?

It would more logical to use a simple IF:

 Code: =IF(B12

You could even use the way TRUE is interpreted as 1 and FALSE is interpreted as 0 when added together, and use the formula:

 Code: =(B12
Villeroy
Super User

Joined: 04 Oct 2004
Posts: 10065
Location: Germany

 Posted: Sun Jun 26, 2011 11:33 am    Post subject: Countif is a little bit silly in this context. Anyhow, you can compare with an operator and a value in one string: =COUNTIF(B12;"<6")+COUNTIF(B12;"<5")+COUNTIF(B12;"<4") or concatenate an operator string with a reference: =COUNTIF(B12;"<"&B9)+COUNTIF(B12;"<"&B10)+COUNTIF(B12;"<"&B11)_________________Rest in peace, oooforum.org Get help on http://forum.openoffice.org
JERRYC
General User

Joined: 26 Jun 2011
Posts: 8

 Posted: Sun Jun 26, 2011 11:36 am    Post subject: Being new to the game, I really appreciate your help. Thanks alot
karolus

Joined: 22 Jun 2011
Posts: 208

Posted: Sun Jun 26, 2011 12:15 pm    Post subject:

Hi
The Job is done by:
 Code: =COUNTIF(B9:B11;">"&B12)

@villeroy
COUNTIF isn't silly in that Context!

Karolus
Ed
Super User

Joined: 28 May 2003
Posts: 1040

Posted: Sun Jun 26, 2011 1:05 pm    Post subject:

karolus wrote:
 Code: =COUNTIF(B9:B11;">"&B12)

@villeroy
COUNTIF isn't silly in that Context!

Maybe not in that formula, but using COUNTIF as JERRYC did with only a single cell in the range is silly!
JERRYC
General User

Joined: 26 Jun 2011
Posts: 8

 Posted: Mon Jun 27, 2011 5:56 am    Post subject: Assigning a value to what if enter 5 in A1 enter 5 in A2 enter 4 in A3 enter 3 in A4 enter 5 in B1 enter 5 in B2 enter 5 in B3 enter 5 in B4 enter 5 in C1 enter 5 in C2 enter 6 in C3 enter 7 in C4 1. What I want is to find the smallest number in (A1:A4) and assign a 2 in a different cell 2. same as 1, but if the smallest number is more than once assign each one a 1 Do the same for (B1:B4) and (C1:C4)Last edited by JERRYC on Mon Jun 27, 2011 7:05 am; edited 1 time in total
karolus

Joined: 22 Jun 2011
Posts: 208

 Posted: Mon Jun 27, 2011 6:28 am    Post subject: Hi With Calc-formulas you cannot assign values to *other* cells, you have to do it with Makrocode ( Basic , Python, etc. ) Karolus
JERRYC
General User

Joined: 26 Jun 2011
Posts: 8

Posted: Mon Jun 27, 2011 6:42 am    Post subject:

 karolus wrote: Hi With Calc-formulas you cannot assign values to *other* cells, you have to do it with Makrocode ( Basic , Python, etc. ) Karolus

I would like to assign it to a different cell
Ed
Super User

Joined: 28 May 2003
Posts: 1040

Posted: Mon Jun 27, 2011 6:57 am    Post subject: Re: Assigning a value to what if

 JERRYC wrote: 1. What I want is to find the smallest number in (A1:A4) and assign it a 2 2. same as 1, but if the smallest number is more than once assign each one a 1 Do the same for (B1:B4) and (C1:C4)

Formulae can not change the contents of cells. All a formula can do is perform a calculation, and the result of that calculation becomes the value of the cell containing the formula.
JERRYC
General User

Joined: 26 Jun 2011
Posts: 8

Posted: Mon Jun 27, 2011 7:06 am    Post subject: Re: Assigning a value to what if

Ed wrote:
 JERRYC wrote: 1. What I want is to find the smallest number in (A1:A4) and assign it a 2 2. same as 1, but if the smallest number is more than once assign each one a 1 Do the same for (B1:B4) and (C1:C4)

Formulae can not change the contents of cells. All a formula can do is perform a calculation, and the result of that calculation becomes the value of the cell containing the formula.

I would like it to assign the value in a different cell
Ed
Super User

Joined: 28 May 2003
Posts: 1040

Posted: Mon Jun 27, 2011 7:29 am    Post subject: Re: Assigning a value to what if

JERRYC wrote:
Ed wrote:
 JERRYC wrote: 1. What I want is to find the smallest number in (A1:A4) and assign it a 2 2. same as 1, but if the smallest number is more than once assign each one a 1 Do the same for (B1:B4) and (C1:C4)

Formulae can not change the contents of cells. All a formula can do is perform a calculation, and the result of that calculation becomes the value of the cell containing the formula.

I would like it to assign the value in a different cell

As has already been said, spreadsheet formulae can not assign values to other cells. Repeating that you want to do something impossible does not magically make it possible.
JERRYC
General User

Joined: 26 Jun 2011
Posts: 8

Posted: Mon Jun 27, 2011 7:38 am    Post subject: Re: Assigning a value to what if

Ed wrote:
JERRYC wrote:
Ed wrote:
 JERRYC wrote: 1. What I want is to find the smallest number in (A1:A4) and assign it a 2 2. same as 1, but if the smallest number is more than once assign each one a 1 Do the same for (B1:B4) and (C1:C4)

Formulae can not change the contents of cells. All a formula can do is perform a calculation, and the result of that calculation becomes the value of the cell containing the formula.

I would like it to assign the value in a different cell

As has already been said, spreadsheet formulae can not assign values to other cells. Repeating that you want to do something impossible does not magically make it possible.

"Formulae can not change the contents of cells. All a formula can do is perform a calculation, and the result of that calculation becomes the value of the cell containing the formula.[/quote] This is what I want, putting a formula in a different cell to get the result"
Ed
Super User

Joined: 28 May 2003
Posts: 1040

 Posted: Mon Jun 27, 2011 7:59 am    Post subject: What result are you trying to get? It is really not at all clear what you are trying to do.
JERRYC
General User

Joined: 26 Jun 2011
Posts: 8

Posted: Mon Jun 27, 2011 8:02 am    Post subject:

 Ed wrote: What result are you trying to get? It is really not at all clear what you are trying to do.

Well, if I don't know what I want you surely can't help, thanks any way.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT - 8 Hours Page 1 of 1

 Jump to: Select a forum OpenOffice.org Forums----------------Setup and TroubleshootingOpenOffice.org WriterOpenOffice.org CalcOpenOffice.org ImpressOpenOffice.org DrawOpenOffice.org MathOpenOffice.org BaseOpenOffice.org Macros and APIOpenOffice.org Code Snippets Community Forums----------------General DiscussionSite Feedback
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum