You are here:

# Excel/Excel/=IF(ISERROR(VLOOKUP(

Question
QUESTION: Using Excel 97-2003

I use the following formula to carry staff hours from weekly payroll tabs to a holiday accrual sheet:

=IF(ISERROR(VLOOKUP(\$A4,WK26!\$1:\$65536,11,0)),0,VLOOKUP(\$A4,WK26!\$1:\$65536,11,0))

The problem I have found is when employees are on the weekly payroll more than once (for example when they are paid at more than one rate) this formula only carries the total hours from the first row, and ignore the rows below which have total hours at different rates.

I've tried adding to the formula to make it search again but I'm having no luck!

Thanks

Ellie

You are correct on the way Vlookup works.  If you need to sum hours from column K based on the value in column A I would suggest

=Sumif(WK26!\$A:\$A,\$A4,WK26!\$K:\$K)

and this will give you the total hours regardless of whether there is one row or multiple rows for that employee. (this assumes hours are stored as numbers which would seem logical)

--
Regards,
Tom Ogilvy

[an error occurred while processing this directive]---------- FOLLOW-UP ----------

QUESTION: Hi Tom,

This formula seemed to work great until random cells came up with #value!

I've checked the format of the cell is general or number which doesn't seem to alter the result.

When I edit the formula the 'save as' box opens with 'update values:wk31' at the top. (as if I was trying to open a new document, and the display at the top is like the title)
I click cancel and get #value!
The formula then looks like this:

=SUMIF(WK31!\$A\$1:\$A\$65536,\$A4,WK31!\$K\$1:\$K\$65536)

I've tried taking out the extra areas but it doesn't work.

I'm not sure if this is a cell issue or a problem with the tab/range being used?!

Many thanks

Ellie

Ellie,

What you describe sounds like what one gets when they have a bad reference in terms of a bad sheet name.

for example (or to confirm) in a new workbook I entered the formula

=SUMIF(Sheet4!A:A,A6,Sheet4!B:B)

and got the update:Sheet4  dialog.  I don't have a Sheet4 in that workbook.

So it sounds like you don't have a sheet named WK31.  If you think you do it is possible it is really

"WK31 "  or " WK31"
Try renaming the sheet to just WK31

--
Regards,
Tom Ogilvy

Questioner's Rating
 Rating(1-10) Knowledgeability = 10 Clarity of Response = 10 Politeness = 10 Comment Tom was excellent - he understood the problem and responded quickly and clearly! Very impressed - thank you very much! Ellie

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

#### Tom Ogilvy

##### Expertise

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

##### Experience

Extensive experience.

Education/Credentials
Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.