You are here:

Excel/Using multiple criteria to return a value from a table


Hi, I have a table with my work hours and shift type. Like this A=date b=clock in c=clock out d=shift type. In another table I would like to calc my salery.

Table indata
    A          B      C      D  
1 01.12.2012  08:00  16:00  LA
2 03.12.2012  16:00  23:00  UL
3 03.12.2012  17:30  18:00  P
4 04.12.2012  12:00  14:00  P
5 06.12.2012  09:00  15:00  UL

Table salery
   A          B      C       D
1 01.12.2012  08:00  16:00  $xxxx
2 02.12.2012  
3 03.12.2012  16:00  23:00  $xxxx
4 04.12.2012
5 05.12.2012
6 06.12.2012  09:00  15:00  $xxxx

B1 =INDEX(indata!B1:B13,MATCH(1,(indata!A1:A13=A1)*(indata!D1:D13="LA"),0))

This formal will only get match if the date=A1 and shift = LA, but I need a formal that will give match if the date=A1 and shift = LA or UL (but not P)

1) How can I get all my LA and UL shift to my salery table?
2) If in the future I get a new shift type like XL. How can I get this shift in my table without change my formal? (So that it will get match on LA, UL and XL)

I would like to have the formal as short as possible. I have tried with if fuction and another one with vlookup fuction

PS I was thinking of having a list of valid shift types Like E1=LA E2=UL E3=XL etc

Hope you understand my problem and have a easy solution

Best regards

This formula will do it, is should be obvious where you would add "XL" to the match array:

In the example picture shown, the formula goes in H1, then is copied down and across through H.  Adjust the "range" of cells (currently 20 rows) to the range needed, don't try to make it a whole column.

         =IFERROR(LOOKUP(2, 1/(($A$1:$A$20=$G1)*OR($D$1:$D$20={"LA","UL"})), B$1:B$20), "")

About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Jerry Beaucaire


Excel Formulas, macros, automation. Microsoft Excel MVP - 2010. Code site with free code snippets and techniques:


Microsoft Excel MVP - 2010. I have my own extensive Excel help/code site: ===================== I have been offering free assistance as an Excel aid on many web sites for many years: ( - JBeaucaire) ======== ( - JBeaucaire) ======= ( - jbeaucaire)

Bachelor's Degree from Azusa Pacific University in Mathematics and Music Composition

Awards and Honors
Microsoft Excel MVP 2010

©2017 All rights reserved.