# Can someone help my tired brain with 2 xcel formulas?

**URL:** https://boards.straightdope.com/t/can-someone-help-my-tired-brain-with-2-xcel-formulas/264701
**Category:** Factual Questions
**Created:** [September 16, 2004, 3:31pm UTC](https://boards.straightdope.com/t/can-someone-help-my-tired-brain-with-2-xcel-formulas/264701 "2004-09-16T15:31:13Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Boyo\_Jim](https://avatars.discourse-cdn.com/v4/letter/b/87869e/32.png) [@Boyo\_Jim](https://boards.straightdope.com/u/Boyo_Jim)
#### Post date: [September 16, 2004, 3:31pm UTC](https://boards.straightdope.com/t/can-someone-help-my-tired-brain-with-2-xcel-formulas/264701/1 "2004-09-16T15:31:13Z")

</div>

I’ve written them out in narrative form as best I could.

Formula 1 (in cell C1)  
If either A1 OR B1 are blank, then C1 is blank.  
If A1 AND B1 exist, AND A1\<120 AND B1\<80, then C1=1.  
Else C1 is blank.

Formula 2 (in cell D1)  
If either A1 OR B1 are blank, then D1 is blank.  
If A1 AND B1 exist, AND 120\<A1\<140 OR 79\<B1\<90, then D1=1.  
Else D1 is blank

---

<div class="post-metadata">

### Author: ![SpaceDog](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/spacedog/32/9932_2.png) [@SpaceDog](https://boards.straightdope.com/u/SpaceDog)
#### Post date: [September 16, 2004, 4:38pm UTC](https://boards.straightdope.com/t/can-someone-help-my-tired-brain-with-2-xcel-formulas/264701/2 "2004-09-16T16:38:56Z")

</div>

> [@Boyo Jim](#):
>
> I’ve written them out in narrative form as best I could.
> 
> Formula 1 (in cell C1)  
> If either A1 OR B1 are blank, then C1 is blank.  
> If A1 AND B1 exist, AND A1\<120 AND B1\<80, then C1=1.  
> Else C1 is blank.

In cell C1 I put …

```auto

=IF(OR((A1=""),(B1="")),"",(IF(AND((A1<120),(B1<80)),1,"")))

```

> [@](#):
>
> Formula 2 (in cell D1)  
> If either A1 OR B1 are blank, then D1 is blank.  
> If A1 AND B1 exist, AND 120\<A1\<140 OR 79\<B1\<90, then D1=1.  
> Else D1 is blank

And in cell D1 I put …

```auto

=IF(OR((A1=""),(B1="")),"",(IF(AND(AND((A1>120),(A1<140)),AND((B1>79),(B1<90))),1,"")))

```

Which is the basically word for word what you wrote (tho’ should the A1\>120 be A1\>119 or A1\>=120 instead ?)

You could probably simplify it more, and you may need to watch if blank cells are auto-filled with zeros.

This is Excel 2000 on a Win98 box.

SD

---

<div class="post-metadata">

### Author: ![SpaceDog](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/spacedog/32/9932_2.png) [@SpaceDog](https://boards.straightdope.com/u/SpaceDog)
#### Post date: [September 16, 2004, 4:44pm UTC](https://boards.straightdope.com/t/can-someone-help-my-tired-brain-with-2-xcel-formulas/264701/3 "2004-09-16T16:44:30Z")

</div>

Gah …

Cell D1:

```auto

=IF(OR((A1=""),(B1="")),"",(IF(OR(AND((A1>120),(A1<140)),AND((B1>79),(B1<90))),1,"")))

```

IF(OR(…),…) in the nested if, not IF(AND(…),…) I misread your post.

I tried looking for a simplification but I can’t really see one, that seems to work fine for me tho’.

Hope that helps.

SD

---

<div class="post-metadata">

### Author: ![Boldface\_Type](https://avatars.discourse-cdn.com/v4/letter/b/b5e925/32.png) [@Boldface\_Type](https://boards.straightdope.com/u/Boldface_Type)
#### Post date: [September 16, 2004, 4:45pm UTC](https://boards.straightdope.com/t/can-someone-help-my-tired-brain-with-2-xcel-formulas/264701/4 "2004-09-16T16:45:22Z")

</div>

> [@Boyo Jim](#):
>
> I’ve written them out in narrative form as best I could.
> 
> Formula 1 (in cell C1)  
> If either A1 OR B1 are blank, then C1 is blank.  
> If A1 AND B1 exist, AND A1\<120 AND B1\<80, then C1=1.  
> Else C1 is blank.

=IF(OR(ISBLANK(A1),ISBLANK(B1)),"",IF(AND(A1\<120, B1\<80),1,""))

> [@](#):
>
> Formula 2 (in cell D1)  
> If either A1 OR B1 are blank, then D1 is blank.  
> If A1 AND B1 exist, AND 120\<A1\<140 OR 79\<B1\<90, then D1=1.  
> Else D1 is blank

Similarly:

=IF(OR(ISBLANK(A1),ISBLANK(B1)),"",IF(AND(A1\>120, A1\<140, B1\>79,B1\<90),1,""))

But in this case you can actually use:  
=IF(AND(A1\>120, A1\<140, B1\>79,B1\<90),1,"")

You need the ISBLANK tests in the first formula because (e.g.) A1\<120 is actually TRUE for a blank cell. However, in the second formula the blank cell will fail the larger-than tests, and so you do not explicitly need to test its blankness.

---

<div class="post-metadata">

### Author: ![Boyo\_Jim](https://avatars.discourse-cdn.com/v4/letter/b/87869e/32.png) [@Boyo\_Jim](https://boards.straightdope.com/u/Boyo_Jim)
#### Post date: [September 17, 2004, 1:11am UTC](https://boards.straightdope.com/t/can-someone-help-my-tired-brain-with-2-xcel-formulas/264701/5 "2004-09-17T01:11:50Z")

</div>

This is where I go for Dial-A-Genius! Thanks. This is for a spreadsheet I’m working on about blood pressure risk assessments. I showed this thread to my boss as a justiification for getting the SDMB cleared therough our corporate web filter. Probably nothing will change, but you never know unless you try.
