ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Using IF function in excel to search for text across cells and she (https://www.excelbanter.com/excel-worksheet-functions/108701-using-if-function-excel-search-text-across-cells-she.html)

Rup1776

Using IF function in excel to search for text across cells and she
 
I am trying to use the IF function to search for a certain abbreviation
across a number of different cells across several sheets. I.e. to count the
number of cells containing this abbreviation.

I have been able to use this for one cell using :

IF(D5="RAB",1,0)

I.e. if D5 contains RAB count 1, otherwise count 0.

How would I reproduce this for a range of cells?
Using the same principle :

IF(D2:D5="RAB",1,0)
However this gives me a result of 0 (when it should be 1)

Im not that experienced with excel so am I using the wrong formula or not
filling correctly, any suggestions?

shail

Using IF function in excel to search for text across cells and she
 
Hi Rup,

You must be looking for the COUNTIF function

=COUNTIF(D2:D5,"RAB")

Hope this works for you.

Thanks

Shail


Rup1776 wrote:
I am trying to use the IF function to search for a certain abbreviation
across a number of different cells across several sheets. I.e. to count the
number of cells containing this abbreviation.

I have been able to use this for one cell using :

IF(D5="RAB",1,0)

I.e. if D5 contains RAB count 1, otherwise count 0.

How would I reproduce this for a range of cells?
Using the same principle :

IF(D2:D5="RAB",1,0)
However this gives me a result of 0 (when it should be 1)

Im not that experienced with excel so am I using the wrong formula or not
filling correctly, any suggestions?



paul

Using IF function in excel to search for text across cells and she
 
your formula will work if you enter it by pressing ctrl and shift and enter
together
if "rab" is in any one of those cells you will get
your formula will look like this
{=IF(D2:D5="RAB",1,0)}
the curly brackets indicate an array formula which will come automatically
upon using the crl shift enter keys together you cant type the {} yourself


--
paul

remove nospam for email addy!



"Rup1776" wrote:

I am trying to use the IF function to search for a certain abbreviation
across a number of different cells across several sheets. I.e. to count the
number of cells containing this abbreviation.

I have been able to use this for one cell using :

IF(D5="RAB",1,0)

I.e. if D5 contains RAB count 1, otherwise count 0.

How would I reproduce this for a range of cells?
Using the same principle :

IF(D2:D5="RAB",1,0)
However this gives me a result of 0 (when it should be 1)

Im not that experienced with excel so am I using the wrong formula or not
filling correctly, any suggestions?


shail

Using IF function in excel to search for text across cells and she
 
Hi Paul,

That will definitely return 1, but Rup might want to count the number
of thimes "RAB" are appearing. Not just want to know it these are
there.

Shail


paul wrote:
your formula will work if you enter it by pressing ctrl and shift and enter
together
if "rab" is in any one of those cells you will get
your formula will look like this
{=IF(D2:D5="RAB",1,0)}
the curly brackets indicate an array formula which will come automatically
upon using the crl shift enter keys together you cant type the {} yourself


--
paul

remove nospam for email addy!



"Rup1776" wrote:

I am trying to use the IF function to search for a certain abbreviation
across a number of different cells across several sheets. I.e. to count the
number of cells containing this abbreviation.

I have been able to use this for one cell using :

IF(D5="RAB",1,0)

I.e. if D5 contains RAB count 1, otherwise count 0.

How would I reproduce this for a range of cells?
Using the same principle :

IF(D2:D5="RAB",1,0)
However this gives me a result of 0 (when it should be 1)

Im not that experienced with excel so am I using the wrong formula or not
filling correctly, any suggestions?



Rup1776

Using IF function in excel to search for text across cells and
 
Thanks, yes this does work perfectly, although to get info from different
sheets i have been using =(COUNTIF(D2:D5,"RAB")+COUNTIF(...."RAB")) which
seems to work well.

Is it possible to autocomplete a new formula to count for "PAR" without
having to manually change the formula? Its not important but would save some
time

Thanks again

Rup

"shail" wrote:

Hi Rup,

You must be looking for the COUNTIF function

=COUNTIF(D2:D5,"RAB")

Hope this works for you.

Thanks

Shail


Rup1776 wrote:
I am trying to use the IF function to search for a certain abbreviation
across a number of different cells across several sheets. I.e. to count the
number of cells containing this abbreviation.

I have been able to use this for one cell using :

IF(D5="RAB",1,0)

I.e. if D5 contains RAB count 1, otherwise count 0.

How would I reproduce this for a range of cells?
Using the same principle :

IF(D2:D5="RAB",1,0)
However this gives me a result of 0 (when it should be 1)

Im not that experienced with excel so am I using the wrong formula or not
filling correctly, any suggestions?




Pete_UK

Using IF function in excel to search for text across cells and she
 
You can put SUM around it like so:

=SUM(IF(D2:D5="RAB",1,0))

then commit with CTRL-SHIFT-ENTER to make it an array function.

Hope this helps.

Pete

shail wrote:
Hi Paul,

That will definitely return 1, but Rup might want to count the number
of thimes "RAB" are appearing. Not just want to know it these are
there.

Shail


paul wrote:
your formula will work if you enter it by pressing ctrl and shift and enter
together
if "rab" is in any one of those cells you will get
your formula will look like this
{=IF(D2:D5="RAB",1,0)}
the curly brackets indicate an array formula which will come automatically
upon using the crl shift enter keys together you cant type the {} yourself


--
paul

remove nospam for email addy!



"Rup1776" wrote:

I am trying to use the IF function to search for a certain abbreviation
across a number of different cells across several sheets. I.e. to count the
number of cells containing this abbreviation.

I have been able to use this for one cell using :

IF(D5="RAB",1,0)

I.e. if D5 contains RAB count 1, otherwise count 0.

How would I reproduce this for a range of cells?
Using the same principle :

IF(D2:D5="RAB",1,0)
However this gives me a result of 0 (when it should be 1)

Im not that experienced with excel so am I using the wrong formula or not
filling correctly, any suggestions?



shail

Using IF function in excel to search for text across cells and
 
hi again Rup,

To count from different worksheets you need to prefix the range with
the name of the sheet. Say if your sheet name is "data" then the
formula will be

=COUNTIF(data!D2:D5,"RAB")+COUNTIF(......)

For the second requirement, you need to tell Excel what to COUNT. For
this you should include "PAR" in your formula as above in place of
"RAB"

Or

For example, have a cell where you can enter "RAB" or "PAR" say at cell
D1

Then the formula will be changed to
=COUNTIF(data!D2:D5,D1)

now when you enter "RAB" at D1 you will get the count of "RAB" and when
you enter "PAR" you will get the count of "PAR".


Thanks again

Shail



Rup1776 wrote:
Thanks, yes this does work perfectly, although to get info from different
sheets i have been using =(COUNTIF(D2:D5,"RAB")+COUNTIF(...."RAB")) which
seems to work well.

Is it possible to autocomplete a new formula to count for "PAR" without
having to manually change the formula? Its not important but would save some
time

Thanks again

Rup

"shail" wrote:

Hi Rup,

You must be looking for the COUNTIF function

=COUNTIF(D2:D5,"RAB")

Hope this works for you.

Thanks

Shail


Rup1776 wrote:
I am trying to use the IF function to search for a certain abbreviation
across a number of different cells across several sheets. I.e. to count the
number of cells containing this abbreviation.

I have been able to use this for one cell using :

IF(D5="RAB",1,0)

I.e. if D5 contains RAB count 1, otherwise count 0.

How would I reproduce this for a range of cells?
Using the same principle :

IF(D2:D5="RAB",1,0)
However this gives me a result of 0 (when it should be 1)

Im not that experienced with excel so am I using the wrong formula or not
filling correctly, any suggestions?





Nobody

Using IF function in excel to search for text across cells and she
 
=SUMPRODUCT(--(D2:D5="RAB"))

"Rup1776" wrote:

I am trying to use the IF function to search for a certain abbreviation
across a number of different cells across several sheets. I.e. to count the
number of cells containing this abbreviation.

I have been able to use this for one cell using :

IF(D5="RAB",1,0)

I.e. if D5 contains RAB count 1, otherwise count 0.

How would I reproduce this for a range of cells?
Using the same principle :

IF(D2:D5="RAB",1,0)
However this gives me a result of 0 (when it should be 1)

Im not that experienced with excel so am I using the wrong formula or not
filling correctly, any suggestions?



All times are GMT +1. The time now is 01:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com