Nested IF Statement not working

snoozee

New Member
Joined
Apr 19, 2007
Messages
37
Hi

I've read through all the posts I can find however I can't seem to find one that helps me work out where i'm going wrong.

This is what i currently have =IF(B2:B8="Y",char(80),IF(AND(D3<$A$1,B2:B8<>"Y"),CHAR(39),CHAR(137)))

Here's what i'm trying to achieve

If ALL cells in the B2:B8 range contain a "Y" and the date (D3) is less than today's date(A1) then CHAR (80), if ANY cells in the range don't ="Y" then CHAR(39) otherwise CHAR(137)

The current statement is only looking at B2 and then returning the desired result so i'm at a loss as to what i'm doing wrong :-)
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Code:
countif(b2:b8,"y")=7

Code:
countif(b2:b8,"y")<>7
 
Last edited:
Upvote 0
Here's what i'm trying to achieve

If ALL cells in the B2:B8 range contain a "Y" and the date (D3) is less than today's date(A1) then CHAR (80), if ANY cells in the range don't ="Y" then CHAR(39) otherwise CHAR(137)
Does this do what you want? If not, further examples & explanation please.

=IF(COUNTIF(B2:B8,"Y")=ROWS(B2:B8),IF(D3<$A1,CHAR(80),CHAR(137)),CHAR(39))
 
Last edited:
Upvote 0
Hi Peter_SS thanks for the prompt reply however it doesn’t work :-(

i’ve decided to simplify this a bit

I need it to look in all cells within the B2:B8 range and if ALL cells are “Y” then Char(80), if ALL cells within this range don’t contain “Y” then Char(137)
 
Upvote 0
JonXL - I decided to add a third condition when the cell is "blank" however this doesn't appear to want to work :-(

=IF(COUNTIF(G8:G13,"Y")=6,CHAR(80),IF(COUNTIF(G8:G13,"Y")<>6,CHAR(209),IF(COUNTIF(G8:G13,"")=6,CHAR(144))))

The first two work perfectly.
 
Upvote 0
Fixed it as wasn't till I looked at it again that i realized i had the last two functions around the wrong way, thanks heaps for your help :-)
 
Upvote 0
Fixed it as wasn't till I looked at it again that i realized i had the last two functions around the wrong way, thanks heaps for your help :-)

You are welcome.

A final note: you can simplify the COUNTIF that checks for all empty cells by using COUNTA, which counts only filled cells and thus doesn't require the second "" argument of the COUNTIF:

Code:
COUNTA(G8:G13)=0
 
Upvote 0

Forum statistics

Threads
1,223,240
Messages
6,170,951
Members
452,368
Latest member
jayp2104

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top