if/and statement

erniepoe

Active Member
Joined
Oct 23, 2006
Messages
375
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I have the following formula, but not working. Currently, the value in G6 is 2018 and H6=P3, so i want the following formula to apply:

(P$2-$I6)/P$2*($J6/26*P$1)

unfortunately, the last formula after the final column is what Excel is finding, which is the formula to use if G6 DOES NOT = 2018.

can anybody spot what I'm doing wrong here? Thanks so much!


=IF(AND($G6="2018",$H6>P$3),0,IF(AND($G6="2018",$H6=P$3),(P$2-$I6)/P$2*($J6/26*P$1),$J6/26*P$1))
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
If the entry in cell G6 is the numeric value 2018, and not the text entry of 2018, then removes the double-quotes from around the number, i.e.
Code:
[COLOR=#333333]=IF(AND($G6=2018,$H6>P$3),0,IF(AND($G6=2018,$H6=P$3),(P$2-$I6)/P$2*($J6/26*P$1),$J6/26*P$1))[/COLOR]
Note: I have not tried to analyze the reset of your formula, just noticed this potential issue sticking out like a sore thumb!
 
Upvote 0
Are you sure H6 and P3 are truly equal, depending on the data source for those cells there could be hidden decimal values that you don't see displayed in the cells but could cause those to not truly be equal.

I would put this formula in a cell and see what you get.

Code:
=h6=p3

If it gives True then you are good, if it is False, then you'd need to look further as to why.
 
Upvote 0
If the entry in cell G6 is the numeric value 2018, and not the text entry of 2018, then removes the double-quotes from around the number, i.e.
Code:
[COLOR=#333333]=IF(AND($G6=2018,$H6>P$3),0,IF(AND($G6=2018,$H6=P$3),(P$2-$I6)/P$2*($J6/26*P$1),$J6/26*P$1))[/COLOR]
Note: I have not tried to analyze the reset of your formula, just noticed this potential issue sticking out like a sore thumb!


yes, it appears that the 2018 should not have had the quotes, as it was the number. Today has not been my day, lol. Thanks for the catch, Joe!
 
Upvote 0
No problem! Glad to help!:)
 
Upvote 0

Forum statistics

Threads
1,216,747
Messages
6,132,483
Members
449,729
Latest member
davelevnt

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