Nested If formula with an AND condition

adrienne0914

Board Regular
Joined
Mar 22, 2018
Messages
57
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

I'm trying to group data based on volume. I'm grouping as follows:
A: >2000
B: 1000-2000
C: 500-999
D: 100-499
E: 1-99​

It looks like this:

CompanyFY 2017YTD 2017YTD 2018Group
ABC Company401212E
DEF Company000F
GHI Company2,4891,136945A
JKL Company1,025250485B
VH1 Company536169101C
CBS Company1557577D
DEC Company0011F

<tbody>
</tbody>

My formula is:
=IF(B2>2000,"A",IF(B2>=1000,"B",IF(B2>=500,"C",IF(B2>=100,"D",IF(B2>0,"E", IF(B2=0,"F",IF(D2=0,"F")))))))

I'm trying to weed out the ones with no activity in 2017 or 2018, making them group F. The way my formula reads now, it assigns group F if B or D equal 0. I don't want DEC Company to be F because there was an increase in activity from 2017 to 2018.

I want the formula to assign group F if B AND D equal 0. Not sure how to insert an AND formula.

Thanks in advance!
 
I think this is what you want...and it wasn't too many nested IFs in Excel 16

PHP:
=IF(AND(B2=0,D2=0),"F",IF(SUM(B2,D2)<>D2,IF(B2>2000,"A",IF(B2>1000,"B",IF(B2>500,"C",IF(B2>100,"D",IF(B2>0,"E"))))),IF(D2>2000,"A",IF(D2>1000,"B",IF(D2>500,"C",IF(D2>100,"D",IF(D2>0,"E","")))))))

Don't be sorry at all. I like it...it was indeed a bunch of IFs...yours is MUCH shorter (y)(y)

I love this forum! This is EXACTLY what I needed. I have Excel 2013, and thought there was a 7 nest limit. I'm glad to know there isn't. Thanks again!!
 
Upvote 0

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Hi,

Sorry jproffer for stepping in, think that's going to be a "bunch" of IFs, here's my suggestion.

E2 formula uses Table G1:I6 (when your parameters change, just change it in the table).
F2 formula has Table hardcoded (when your parameters change, you'll have to update the formula, but you don't need G1:I6).

ABCDEFGHI
1CompanyFY 2017YTD 2017YTD 2018GroupGroup00F
2ABC Company401212EE199E
3DEF Company000FF100499D
4GHI Company2,4891,136945AA500999C
5JKL Company1,025250485BB10002000B
6VH1 Company536169101CC2001A
7CBS Company1557577DD
8DEC Company0011EE

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet69

Worksheet Formulas
CellFormula
E2=LOOKUP(IF(B2=0,D2,B2),G$1:G$6,I$1:I$6)
F2=LOOKUP(IF(B2=0,D2,B2),{0,1,100,500,1000,2001},{"F","E","D","C","B","A"})

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>



Either way, formula copied down.

This is great! The grouping numbers did actually change. So this will speed up the process in the future. Thanks!
 
Upvote 0

Forum statistics

Threads
1,215,506
Messages
6,125,193
Members
449,213
Latest member
Kirbito

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