Adding to a IF(MODE( formula

brooksc29

Active Member
Joined
Jul 25, 2010
Messages
333
I'd like to add the following to this formula below.

=IFERROR(MODE(IF(PitcherName=IF($X$2="All",PitcherName,$X$2),IF(CatcherName=IF($X$3="All",CatcherName,$X$3),IF(Inning=IF($X$5="All",Inning,$X$5),IF(AllP=IF($X$4="ALL",AllP,$X$4),IF(HitterStance="R",IF(PitchStart=1,IF(ISNUMBER(PitchFinish),IF(PitchStart<>PitchFinish, PitchFinish))))))))),"-")

I need add to the formula so that will only search within the user driven Start and End Dates.

in other words, IF((GameDate>=StartDate)AND(GameDate<=EndDate) then =IFERROR(MODE(IF(PitcherName=IF($X$2="All",PitcherName,$X$2),IF(CatcherName=IF($X$3="All",CatcherName,$X$3),IF(Inning=IF($X$5="All",Inning,$X$5),IF(AllP=IF($X$4="ALL",AllP,$X$4),IF(HitterStance="R",IF(PitchStart=1,IF(ISNUMBER(PitchFinish),IF(PitchStart<>PitchFinish, PitchFinish))))))))),"-")

how can I combine these two?
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hi brooksc29,

You can combine them as follow:

Code:
=IF(AND(GameDate>=StartDate,GameDate<=EndDate),
[COLOR=Blue][B]IFERROR(MODE(IF(PitcherName=IF($X$2="All",PitcherName,$X$2),
IF(CatcherName=IF($X$3="All",CatcherName,$X$3),
IF(Inning=IF($X$5="All",Inning,$X$5),IF(AllP=IF($X$4="ALL",AllP,$X$4),
IF(HitterStance="R",IF(PitchStart=1,IF(ISNUMBER(PitchFinish),
IF(PitchStart<>PitchFinish, PitchFinish))))))))),"-")[/B][/COLOR],[B][COLOR=Red]"Negative part[/COLOR][/B]")
Only is pending you to decide what the formula will do in the negative part (in red) of the main
IF() statement, because the positive part is the large formula (in blue).

Hope it helps.

Regards.
 
Upvote 0
thank you!

so basically, in the negative part, I am saying if the date range is not between the start date and end date - or if there is no data between the date range?
 
Upvote 0
Brooks,

I'm not sure if is what you need. If you need to show a "-" when an error occurs or if the condition is out of the range stablished,
you can put in the negative part the same symbol as follow:
Code:
=IF(AND(GameDate>=StartDate,GameDate<=EndDate),
[COLOR=Blue][B]IFERROR(MODE(IF(PitcherName=IF($X$2="All",PitcherName,$X$2),
IF(CatcherName=IF($X$3="All",CatcherName,$X$3),
IF(Inning=IF($X$5="All",Inning,$X$5),IF(AllP=IF($X$4="ALL",AllP,$X$4),
IF(HitterStance="R",IF(PitchStart=1,IF(ISNUMBER(PitchFinish),
IF(PitchStart<>PitchFinish, PitchFinish))))))))),"-")[/B][/COLOR],[B][COLOR=Red]"-"[/COLOR][/B])
Regards
 
Upvote 0
thank you sir...

that's a working formula, but it's giving me "-" and there is definitely a MODE between those dates...

I should be entering as an array, right?

I know it's tough to help when I'm not describing the data all that well.
 
Upvote 0
You're welcome Brooks,

As MODE may contain a arrays as arguments, enter the formula as an array
and see if works.

Regards
 
Upvote 0
i'm still getting "-" or no result... not sure why

i went back and cleared the data in NamedRange GameDate... made sure the cells were formatted as date... and entered the dates again... still getting "-"


any ideas?
 
Upvote 0
Try,

Code:
=IFERROR(MODE(IF(GameDate>=StartDate,IF(GameDate<=EndDate,
IF(PitcherName=IF($X$2="All",PitcherName,$X$2),
IF(CatcherName=IF($X$3="All",CatcherName,$X$3),
IF(Inning=IF($X$5="All",Inning,$X$5),IF(AllP=IF($X$4="ALL",AllP,$X$4),
IF(HitterStance="R",IF(PitchStart=1,IF(ISNUMBER(PitchFinish),
IF(PitchStart<>PitchFinish, PitchFinish))))))))))),"-")
 
Upvote 0

Forum statistics

Threads
1,224,517
Messages
6,179,242
Members
452,898
Latest member
Capolavoro009

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