Help make this formula more elegant

ireland87

Board Regular
Joined
Jul 22, 2015
Messages
52
Hi

I've got this formula which works correctly but is a bit long winded and has a few nested IF statements;

=IF(G7="eombh",INDEX(E2:E22,MATCH(1,(G2=A2:A22)*(G3=B2:B22),0)),IF(G7="eom",INDEX(D2:D22,MATCH(1,(G2=A2:A22)*(G3=B2:B22),0)),(INDEX(C2:C22,MATCH(1,(G2=A2:A22)*(G3=B2:B22),0)))))

G2= system
G3 = Day
G7="eombh etc"


System A
Monday08:0008:1509:00
System ATuesday08:3008:4509:15
System BMonday07:0007:1508:15
System BTuesday07:3007:4508:50

<tbody>
</tbody>

can anyone help with simplify it?

many thanks
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
can anyone help with simplify it?

Hi, if you put the possible values of G7 into the appropiate columns header of your lookup table you can use something like this.


Excel 2013/2016
ABCDEFGHI
1othereomeombh
2System AMonday08:0008:1509:00System A08:45:00
3System ATuesday08:3008:4509:15Tuesday
4System BMonday07:0007:1508:15
5System BTuesday07:3007:4508:50
6
7eom
Sheet1
Cell Formulas
RangeFormula
I2{=INDEX($C$2:$E$5,MATCH(1,(A2:A22=G2)*(B2:B22=G3),0),MATCH(G7,C1:E1,0))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Maybe this?

=INDEX(C2:E22,MATCH(1,INDEX((A2:A22=G2)*(B2:B22=G3),0),0),IFERROR(VLOOKUP(G7,{"eombh",3;"eom",2},2,0),1))
 
Upvote 0
Hi, if you put the possible values of G7 into the appropiate columns header of your lookup table you can use something like this.

Excel 2013/2016
ABCDEFGHI
1othereomeombh
2System AMonday08:0008:1509:00System A08:45:00
3System ATuesday08:3008:4509:15Tuesday
4System BMonday07:0007:1508:15
5System BTuesday07:3007:4508:50
6
7eom

<tbody>
</tbody>
Sheet1

Array Formulas
CellFormula
I2{=INDEX($C$2:$E$5,MATCH(1,(A2:A22=G2)*(B2:B22=G3),0),MATCH(G7,C1:E1,0))}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>

Yeah that did the job nicely, many thanks
 
Upvote 0
I wonder if anyone could simplify the first part of the formula which determines what is in cell G7

=IF(AND(ISNUMBER(MATCH(I2,M2:M7,0)),ISNUMBER(MATCH(I2,J2,0))),"eombh",IF(ISNUMBER(MATCH(I2,J2,0)),"eom",IF(ISNUMBER(MATCH(I2,M2:M7,0)),"bh","normal")))

DateEOMBank Holiday Dates
26/02/201928/02/201902/03/2019
04/03/2019

<tbody>
</tbody>
 
Upvote 0
=IF(AND(ISNUMBER(MATCH(I2,M2:M7,0)),ISNUMBER(MATCH(I2,J2,0))),"eombh",IF(ISNUMBER(MATCH(I2,J2,0)),"eom",IF(ISNUMBER(MATCH(I2,M2:M7,0)),"bh","normal")))

Hi, I think this is equivalent.

=IF(ISNUMBER(MATCH(I2,M2:M7,0)),IF(I2=J2,"eombh","bh"),IF(I2=J2,"eom","normal"))
 
Upvote 0
can i somehow get another query in front of;

=IF(ISNUMBER(MATCH(J2,N2:N7,0)),IF(J2=K2,"eombh","bh"),IF(J2=K2,"eom","normal"))

to first look at system H2 then compare the possible bank holiday dates in N2:P7

=IF(MATCH(H2,N1:P1,0),IF(ISNUMBER(MATCH(J2,$N$2:$P$7,0)),IF(J2=K2,"eombh","bh"),IF(J2=K2,"eom","normal")))

but this is not returning the correct result like the first formula

any ideas?
 
Upvote 0
to first look at system H2 then compare the possible bank holiday dates in N2:P7

Hi, what should be returned when there is a match to the bank holiday dates - what should be returned when there isn't?
 
Upvote 0

Forum statistics

Threads
1,213,501
Messages
6,114,010
Members
448,543
Latest member
MartinLarkin

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