ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   how to use the IF formula with a range of cells (https://www.excelbanter.com/excel-discussion-misc-queries/87342-how-use-if-formula-range-cells.html)

JohnD

how to use the IF formula with a range of cells
 
I have a text in one cell (J2) and have to compare it with text in a range of
cells (B2:B999) to return an expression if true. I have tried using the IF
function e.g
IF(J2=B2:B28,"Ordered","Not Ordered"), but it doesn't appear to like working
with a range of cell, works fine if you I point it to a single cell. Any help
would be appreciated.

Gizmo63

how to use the IF formula with a range of cells
 
Hi John,

=IF(SUMPRODUCT(--(B2:B999=J2)),"Ordered", "Not Ordered")

HTH

Giz

"JohnD" wrote:

I have a text in one cell (J2) and have to compare it with text in a range of
cells (B2:B999) to return an expression if true. I have tried using the IF
function e.g
IF(J2=B2:B28,"Ordered","Not Ordered"), but it doesn't appear to like working
with a range of cell, works fine if you I point it to a single cell. Any help
would be appreciated.


Ardus Petus

how to use the IF formula with a range of cells
 
=IF(COUNTIF(B2:B999,J2)0,"Ordered","Not Ordered")

HTH
--
AP

"JohnD" a écrit dans le message de news:
...
I have a text in one cell (J2) and have to compare it with text in a range
of
cells (B2:B999) to return an expression if true. I have tried using the IF
function e.g
IF(J2=B2:B28,"Ordered","Not Ordered"), but it doesn't appear to like
working
with a range of cell, works fine if you I point it to a single cell. Any
help
would be appreciated.




CLR

how to use the IF formula with a range of cells
 
=IF(ISNA(VLOOKUP(J2,B:B,1,FALSE)),"Not Ordered","Ordered")

Vaya con Dios,
Chuck, CABGx3



"JohnD" wrote:

I have a text in one cell (J2) and have to compare it with text in a range of
cells (B2:B999) to return an expression if true. I have tried using the IF
function e.g
IF(J2=B2:B28,"Ordered","Not Ordered"), but it doesn't appear to like working
with a range of cell, works fine if you I point it to a single cell. Any help
would be appreciated.


CC

how to use the IF formula with a range of cells
 
if is to compare Cells with text try this
=IF(OR(EXACT(A1,H1:H9)),"Not ordered"," ordered")

"The formula in the example must be entered as an array formula (array
formula: A formula that performs multiple calculations on one or more sets of
values, and then returns either a single result or multiple results. Array
formulas are enclosed between braces { }, and are entered by pressing
CTRL+SHIFT+ENTER.). After copying the example to a blank worksheet, select
each formula cell individually. Press F2, and then press CTRL+SHIFT+ENTER. If
the formula is not entered as an array formula, the error #VALUE! is returned.

The formula above uses the following syntax:

=OR(EXACT(TestValue, CompareRange))

TestValue refers to a cell containing a user-entered value; CompareRange
refers to a list of text values to be compared against.

cc




"JohnD" wrote:

I have a text in one cell (J2) and have to compare it with text in a range of
cells (B2:B999) to return an expression if true. I have tried using the IF
function e.g
IF(J2=B2:B28,"Ordered","Not Ordered"), but it doesn't appear to like working
with a range of cell, works fine if you I point it to a single cell. Any help
would be appreciated.



All times are GMT +1. The time now is 05:11 PM.

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