Merging 3 IF statements based on text in another field

HACZN12

New Member
Joined
Apr 20, 2017
Messages
14
To Whom it Concerns,


I've got 3 different tables for 3 different firms, I've created 3 IF statements which each select a value if the value is below a certain amount it multiplies it by the lowest value in the table; if not it will multiply it by the highest value.

The issue is each IF statement is relevant to a different table. My spreadsheet has a column for 'Firm name'; I need a formula that will look at the firm name and choose the relevant IF statement for the relevant firm.

So far my formula looks something like this:


=IF((AND(FY9="Firm 1")*(FE9<500000)),(FE9*'Legal Fees'!$E$29),(MASTER!FE9*'Legal Fees'!$E$35)OR(IF((AND(FY9="Firm 2")*(FE9<500000)),(FE9*'Legal Fees'!$E$42),(MASTER!FE9*'Legal Fees'!$E$48)OR(IF((AND(FY9="Firm 3")*(FE9<500000)),(FE9*'Legal Fees'!$E$55),(MASTER!FE9*'Legal Fees'!$E$61))


This doesn't seem to work for 2 reasons:

1) I don't seem to have joined each IF statement correctly using the OR function (not sure where i'm going wrong)

2) currently I have the 'AND' function for the firm name only applying to where the initial value is less than 500000; it should be " IF Firm 1 then IF lower that 500000 pull lowest value from Firm 1 Table, if not pull highest value from firm 1 table, IF Firm 2, IF initial value is less that 500000 pull lowest value from Firm 2 table, if not pull highest value from Firm 2 table, IF firm 3, IF value is less that 500000 pull lowest value from Firm 3 table, if not pull highest value from 'Firm 3' table.

Finding this pretty difficult and it would be great if I could get some help as soon as possible!

Many Thanks

HaczN12
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Have you got an example of the spreadsheet to post? how big are the tables for Firm1,2 and 3 and where abouts are these tables located?

If you can send an example of the spreadsheet I believe I can help.
 
Upvote 0
Have you got an example of the spreadsheet to post? how big are the tables for Firm1,2 and 3 and where abouts are these tables located?

If you can send an example of the spreadsheet I believe I can help.


Hi Sephi, thank you for the prompt response, the table looks like this (this is just a mock table I've created as the information I work with is confidential):


Tab A

Reference valueField for formulaSolicitor
2502500Firm A
3009000Firm B
35017500Firm C

<tbody>
</tbody><colgroup><col><col><col></colgroup>

TAB B


Firm AFirm BFirm C
Minimum value103050
Maximum value204060

<tbody>
</tbody><colgroup><col><col span="3"></colgroup>


In this example; the formula would be prevalent in the 'Field for Formula' Column, the formula should multiply the value in the 'Reference Value' by either:

-The 'minimum value' in the TAB 2 table if the 'Reference value' is less than 500, if not it will select the 'maximum value'

-It selects the relevant section of the table in 'TAB 2' based on the appropriate firm stated in the 'solicitor' column in TAB

Let me know if you need more info

Many Thanks!

Hacz
 
Upvote 0
TAB A
ABC
1Reference ValueField For FormulaSolicitor
2250Firm A
3300Firm B
4500Firm C

<tbody>
</tbody>









TAB B
ABCD
1Firm AFirm BFirm C
2Minimum Value103050
3Maximum Value204060

<tbody>
</tbody>

Using the above as you have described, try using in cell B2 on "TAB A" the following formula to drag down to B4.
Code:
=IF($A2<500,$A2*INDEX('TAB B '!$B$2:$D$3,MATCH("Minimum Value",'TAB B '!$A$2:$A$3,0),MATCH($C2,'TAB B '!$B$1:$D$1,0)),$A2*INDEX('TAB B '!$B$2:$D$3,MATCH("Maximum Value",'TAB B '!$A$2:$A$3,0),MATCH($C2,'TAB B '!$B$1:$D$1,0)))

This is basically saying if your reference value is less than 500, then it'll do an index match match against your firm on TAB B for the minimum value, and if it isn't it'll do an index match match against the maximum value.

Hope this is what you're looking for and is adaptable to your needs :)
 
Upvote 0
TAB A
ABC
1Reference ValueField For FormulaSolicitor
2250Firm A
3300Firm B
4500Firm C

<tbody>
</tbody>









TAB B
ABCD
1Firm AFirm BFirm C
2Minimum Value103050
3Maximum Value204060

<tbody>
</tbody>

Using the above as you have described, try using in cell B2 on "TAB A" the following formula to drag down to B4.
Code:
=IF($A2<500,$A2*INDEX('TAB B '!$B$2:$D$3,MATCH("Minimum Value",'TAB B '!$A$2:$A$3,0),MATCH($C2,'TAB B '!$B$1:$D$1,0)),$A2*INDEX('TAB B '!$B$2:$D$3,MATCH("Maximum Value",'TAB B '!$A$2:$A$3,0),MATCH($C2,'TAB B '!$B$1:$D$1,0)))

This is basically saying if your reference value is less than 500, then it'll do an index match match against your firm on TAB B for the minimum value, and if it isn't it'll do an index match match against the maximum value.

Hope this is what you're looking for and is adaptable to your needs :)


Thanks for this Sephi,

It seems to work for Firm A and C, it didn't however calculate correctly for Firm B, I tried modifying it but i'm not too sure what i'm doing wrong,


I attempted to re-write the formula: =IF($A2<500,$A2*INDEX('Tab B'!$B$2:$D$3,MATCH('Tab B'!$A$2,'Tab B'!$A$2:$A$3,0),MATCH('Tab A'!$C$2,'Tab B'!$B$1:$D$1,0)),'Tab A'!$A2*INDEX('Tab B'!$B$2:$D$3,MATCH('Tab B'!$A$3,'Tab B'!$A$2:$A$3,0),MATCH('Tab A'!$C2,'Tab B'!$B$1:$D$1,0)))




But got the following results:


Reference ValueField For FormulaSolicitor
2502500Firm A
3003000Firm B
50030000Firm C

<tbody>
</tbody><colgroup><col><col><col></colgroup>


Field B2 displays 3000 when it should calculate 300 x 30 and give 9000, it must be somehow pulling from the wrong minimum!

Do you know what could be done to change this?

Many Thanks
 
Upvote 0
TAB A
ABC
1Reference ValueField For FormulaSolicitor
2250Firm A
3300Firm B
4500Firm C

<tbody>
</tbody>









TAB B
ABCD
1Firm AFirm BFirm C
2Minimum Value103050
3Maximum Value204060

<tbody>
</tbody>

Using the above as you have described, try using in cell B2 on "TAB A" the following formula to drag down to B4.
Code:
=IF($A2<500,$A2*INDEX('TAB B '!$B$2:$D$3,MATCH("Minimum Value",'TAB B '!$A$2:$A$3,0),MATCH($C2,'TAB B '!$B$1:$D$1,0)),$A2*INDEX('TAB B '!$B$2:$D$3,MATCH("Maximum Value",'TAB B '!$A$2:$A$3,0),MATCH($C2,'TAB B '!$B$1:$D$1,0)))

This is basically saying if your reference value is less than 500, then it'll do an index match match against your firm on TAB B for the minimum value, and if it isn't it'll do an index match match against the maximum value.

Hope this is what you're looking for and is adaptable to your needs :)

Had a go at modifying the formula and it now works perfect! thanks a lot for helping me with this :D
 
Upvote 0

Forum statistics

Threads
1,215,972
Messages
6,127,997
Members
449,414
Latest member
sameri

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