Nested IF(OR with Indexes

davefaust78

New Member
Joined
Sep 11, 2017
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Hi,

I am trying to get a nested IF(or formula to work depending on what's in a cell. My formula looks like this so far:

=IF(or((H5="Chest",INDEX(Chest,RANDBETWEEN(1,15),1),"Needs Workout"),(H5="Bodyweight",INDEX(Bodyweight,RANDBETWEEN(1,21),1))

If I remove the OR( part of the statement and just close it at the IF( the formula works just fine. I type "Chest" in cell H5 and I get a random value from my chest range. Once I try to now add-in the additional OR( argument is where I'm having the difficulty. The problem I'm having is closing the statement.

I included an image of my named ranges to show where the indexed lists reside.

This is for a weekly workout routine that randomizes the workouts depending on body part I want to do that day. Ideally, I'd also like to add-in other indexed lists I created for Arms, Legs, Core, etc.

I hope you can help.

Thank you,

Dave
 

Attachments

  • Named Ranges.gif
    Named Ranges.gif
    177.3 KB · Views: 3

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
How about
=IF(H5="Chest",INDEX(Chest,RANDBETWEEN(1,15),1),if(H5="Bodyweight",INDEX(Bodyweight,RANDBETWEEN(1,21),1),"Needs Workout"))
 
Upvote 0
I think what you want is :

=IF(H5="Chest",INDEX(Chest,RANDBETWEEN(1,15),1),IF(H5="Bodyweight",INDEX(Bodyweight,RANDBETWEEN(1,21),1),"Needs Workout"))
 
Upvote 0
How about
=IF(H5="Chest",INDEX(Chest,RANDBETWEEN(1,15),1),if(H5="Bodyweight",INDEX(Bodyweight,RANDBETWEEN(1,21),1),"Needs Workout"))


This is perfect! I was just so unsure of the format of the statement and how to end it. Works like a charm!! Thank you so very much!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,279
Members
449,075
Latest member
staticfluids

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