Can't figure out the formula.

canthony24

Board Regular
Joined
Mar 24, 2016
Messages
69
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)
 

Some videos you may like

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Scott T

Well-known Member
Joined
Dec 14, 2016
Messages
2,616
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
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,""))))
 

canthony24

Board Regular
Joined
Mar 24, 2016
Messages
69
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,""))))
 

Scott T

Well-known Member
Joined
Dec 14, 2016
Messages
2,616
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
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,""))))
 

Watch MrExcel Video

Forum statistics

Threads
1,123,336
Messages
5,601,023
Members
414,421
Latest member
tonybear1994

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
Top