Can't figure out the formula.

canthony24

Board Regular
Joined
Mar 24, 2016
Messages
70
I'm trying to figure out how to write this formula. The user can select either 'Cases' or 'Pounds' in the beginning.

B2 is a drop down list 'Cases' or 'Pounds'.
AD3 is a drop down list 'Yes' or 'No'.
AF3 is a drop down list 'Yes' or 'No'.
Pivot_CasesAV36 is the result if 'Cases' and 'Yes' 'Yes' are selected.
Pivot_CasesAO36 is the false result if AD3 and AF3 aren't both 'Yes'.
Pivot_PoundsAV36 is the result if 'Pounds' and 'Yes' 'Yes' are selected.
Pivot_PoundsAO36 is the false result if AD3 and AF3 aren't both 'Yes'.

So far I have this, but when it comes to entering the FALSE statement and the 'Pounds' results, I get tripped up. How can I add the 'Pounds' now? I can get the 'Cases' but can't figure out the next one. Maybe OR?

=IF(AND($B$2="Cases",$AD$3="yes",$AF$3="yes"),Pivot_Cases!AV36,Pivot_Cases!AO36)
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
does this do what you want.
Code:
=IF(AND(B2="Cases",AD3="yes",AF3="yes"),Pivot_Cases!AV36,IF(AND(B2="Cases",OR(AD3="no",AF3="no")),Pivot_Cases!AO36,IF(FALSE,'Pivot_PoundsAO36 '!AV36,IF(AND(B2="pounds",OR(AD3="no",AF3="no")),'Pivot_PoundsAO36 '!AO36,""))))
 
Upvote 0
does this do what you want.
Code:
=IF(AND(B2="Cases",AD3="yes",AF3="yes"),Pivot_Cases!AV36,IF(AND(B2="Cases",OR(AD3="no",AF3="no")),Pivot_Cases!AO36,IF(FALSE,'Pivot_PoundsAO36 '!AV36,IF(AND(B2="pounds",OR(AD3="no",AF3="no")),'Pivot_PoundsAO36 '!AO36,""))))

The first part it does. But when I select 'Pounds' I get a #REF . I was trying to figure out the last part of the formula. Is it supposed to be like that?

IF(FALSE,'Pivot_PoundsAO36 '!AV36,IF(AND(B2="pounds",OR(AD3="no",AF3="no")),'Pivot_PoundsAO36 '!AO36,""))))
 
Upvote 0
Now that I think about it more you do not need the AND and the Or statements when testing if one cell is no as if they are not both yes then at least one must be no

Code:
=IF(AND(B2="Cases",AD3="yes",AF3="yes"),Pivot_Cases!AV36,IF(B2="Cases",Pivot_Cases!AO36,IF(AND(B2="pounds",AD3="yes",AF3="yes"),'Pivot_PoundsAO36 '!AV36,IF(B2="pounds",'Pivot_PoundsAO36 '!AO36,""))))
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

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