VBA or Formula for 35 nested IF AND statements

SierraDelta

New Member
Joined
Feb 27, 2017
Messages
5
Hi All,

I've been struggling with this problem all day. I've searched through existing posts for nesting statements, but my scenario doesn't match with anything I've found so far.

I have 3x different drop down lists. The combination of their values form the qualifiers for the numeric result at the end of my current IF AND statement. I have the "Total Hours" values for each combination - I don't mind entering them manually.

The following statement works, but obviously only for 1 combination. I need this logic for 36 x3 combinations. If the script or formula can allow me to keep entering the Total Hours values manually that would be perfect.

=IF(AND(D6="Care Report";G6="Chaos";K6="1");"26";"26")

ABCD
1Assessment Type
(Drop Down)
Maturity Level
(Drop Down)
Data Quantity
(Drop Down)
Total Hours
(Fixed formula Answer Cell)
2Report 101(see formula above)
313
426
539
6412
7524
8
9Report 201
1013
1126
1239
13412
14524
15
16Report 301
1713
1826
1939
20412
21524

<tbody>
</tbody>




































I would be very grateful for any guidance/help.

Thanks,
SD
 
Functionally, the concept behind Dr. Demento's VBA function (or stumac's) and my worksheet formula is the same. In each case a table is created of the combinations, and the routine searches the table for a match. His table is in the macro, mine is in another location in the workbook. The main difference is whether you want to use VBA or not. Some people don't want to use VBA because they don't understand it, or workplace restrictions forbid it.

If you're happy with a VBA solution, by all means go that direction. Let me know if you have questions about a formula-based solution.
 
Upvote 0

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Dr. Demento, would you still be able to put an example worksheet together for me?

stumac has the correct approach (I would have gotten there eventually). My initial approach of using a Worksheet_Change has a huge amount of overhead (it runs everytime there's a change/data entry/etc on the sheet). That would make for a very slow process. stu's approach is nice because it allows you to enter the values independently (which is good because the setup you provided is nice for data presentation but poor for data entry).

However, as Eric pointed out, each of our methods are fundamentally the same; only the approach varies.

Is stumac's example enough to get you going??
 
Upvote 0
I believe it is. I'm new to VBA but will Google and sticky tape it. I've just been given another project to complete but will be able to use this over the weekend. I will then indicate whether or not I could get it going. Thanks!
 
Upvote 0

Forum statistics

Threads
1,215,456
Messages
6,124,939
Members
449,197
Latest member
k_bs

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