+ Reply to Thread
Results 1 to 4 of 4

VLookup

  1. #1
    Registered User
    Join Date
    05-19-2008
    Posts
    56

    VLookup

    I have 2 sheets, one (numerically named for the day of the month, in this example '1') has daily records on vehicle mileage, where column A is the vehicle registration number (VRM), column C the daily mileage.
    Sheet 2 (Total) is a running total for the month of mileage for each vehicle.

    My formula, placed in the Total sheet, is =IF(COUNTIF('1'!$A:$A,""),"",IF(COUNTIF('1'!$A:$A,Total!$A2),VLOOKUP(Total!$A2,'1'!$A:$C,3,FALSE),"0 "))

    What I am trying to do is the following:

    If the daily VRM list ('1'$A$A) is empty, then leave the cell null
    ELSE
    If the VRM that corresponds to my cell in the Total sheet (Total!$A2) is present in the daily VRM list then perform a VLOOKUP on column C of the daily sheet
    ELSE
    Enter a '0' value in the cell.

    Except it's not working. Can anyone see from looking at the formula what is wrong? Or do you need to see examples?

  2. #2
    Registered User
    Join Date
    08-04-2009
    Location
    Brussels, Belgium
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: Help with VLOOKUP formula please

    could you post an example?

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,699

    Re: Help with VLOOKUP formula please

    Try like this

    =IF(COUNTA('1'!$A:$A),IF(COUNTIF('1'!$A:$A,Total!$A2),VLOOKUP(Total!$A2,'1'!$A:$C,3,FALSE),0),"")

  4. #4
    Registered User
    Join Date
    05-19-2008
    Posts
    56

    VLOOKUP - Imported data producing Invalid Cell Reference Error.

    Quote Originally Posted by daddylonglegs View Post
    Try like this

    =IF(COUNTA('1'!$A:$A),IF(COUNTIF('1'!$A:$A,Total!$A2),VLOOKUP(Total!$A2,'1'!$A:$C,3,FALSE),0),"")

    Thanks, this works. However, I now appear to have a problem with the data I am importing. I have attached an exmple file.

    Worksheet '1' has data I have manually keyed in and this is reflected in column 'D' of the Total sheet.

    Worksheet '2' has data I have imported from the daily file and this returns zeros where I would expect in Totals column D (vehicle not in file) but the vehicles which ARE present in the daily file are producing an Invalid Cell Reference Error.

    Can anyone tell me why?
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1