• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

XLOOKUP - if_not_found isn't working|General Excel Questions & Answers|Excel Forum|My Online Training Hub

You are here: Home / XLOOKUP - if_not_found isn't working|General Excel Questions & Answers|Excel Forum|My Online Training Hub

vba course banner

Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumGeneral Excel Questions & Answe…XLOOKUP - if_not_found isn't workin…
sp_PrintTopic sp_TopicIcon
XLOOKUP - if_not_found isn't working
Avatar
Ashley Gonzalez

New Member
Members
Level 0
Forum Posts: 2
Member Since:
June 11, 2020
sp_UserOfflineSmall Offline
1
June 11, 2020 - 10:00 pm
sp_Permalink sp_Print

I have a pretty simple spreadsheet. I'm using XLOOKUP to pull data from two sheets within one workbook, based on the email address. The formula works and inputs the correct date for the email address. However, if nothing exists in the field, I want the field to remain blank. The output ends up being an empty date of 1/0/00. If I don't have the cells formatted as a date, the dates come in as numbers and I get a 0 for those empty fields. 

=XLOOKUP(F2,'Opt Outs'!A:A,'Opt Outs'!B:B,,0,1)

It does not matter what I put in the if_not_found field, it returns the 1/0/00 date. I would like for it to remain empty. Any suggestions?

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1530
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
2
June 11, 2020 - 10:48 pm
sp_Permalink sp_Print

Hi Ashley,

On row 2 you are looking up abc@123.com and this is found in ColA of the Opt Outs sheet.  So XLOOKUP is returning what it finds in the column you specify e.g.

=XLOOKUP(F2,'Opt Outs'!A:A,'Opt Outs'!E:E,,0,1)

returns the value in Column E which is an empty cell so XLOOKUP is returning 0.

You are asking XLOOKUP to find a value in Col A which it is doing, but there's no way to tell it not to return what it finds in Col E if that cell in Col E is empty.

If you want it to return 'nothing' you could put a space character into the 'empty' cells on the Opt Out pages, or a better solution would be to use a custom format on the cells on the Complete List sheet to not display 0.  Something like this

d/mm/yyyy;;;

Also, you need to explicitly specify what to return if the lookup is not found e.g.

=XLOOKUP(F2,'Opt Outs'!A:A,'Opt Outs'!E:E,"",0,1)

Regards

Phil

Avatar
Ashley Gonzalez

New Member
Members
Level 0
Forum Posts: 2
Member Since:
June 11, 2020
sp_UserOfflineSmall Offline
3
June 12, 2020 - 3:23 am
sp_Permalink sp_Print

Hi Philip,

Thank you for responding. I have tried using the "" for the if_not_found, but it will always default to the 1/0/00 or 0. I will try the custom formatting to see if that solves the problem. Unfortunately, using the space doesn't work either because there is another sheet that creates counts for the lists. 

Thanks,

Ashley

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1530
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
4
June 12, 2020 - 9:02 am
sp_Permalink sp_Print

Hi Ashley,

As the email address is being found, XLOOKUP will return something, so specifying "" for if_not_found is not applicable in such cases as something is found.

So using the custom format to not display 0 is the solution.

regards

Phil

Avatar
david skeehan

New Member
Members
Level 0
Forum Posts: 1
Member Since:
July 11, 2020
sp_UserOfflineSmall Offline
5
July 11, 2020 - 2:11 pm
sp_Permalink sp_Print

I had the same issue and saw the posts from Ashley and Philip. Here's what I found elsewhere:

File, Options, Advanced, Display options for this worksheet, uncheck "Show a zero in cells that have zero value"

It will "blank" any cell with just a zero - not just the ones returned by lookups. That wasn't an issue for my purposes.

Regards,

David

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Alicia Greynolds
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 873
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 222
Jessica Stewart: 218
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Blair Gallagher
Brandi Taylor
Hafiz Ihsan Qadir
Gontran Bage
adolfo casanova
Annestine Johnpulle
Priscila Campbell
Jeff Mikles
Aaron Butler
Maurice Petterlin
Forum Stats:
Groups: 3
Forums: 24
Topics: 6369
Posts: 27852

 

Member Stats:
Guest Posters: 49
Members: 32359
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.

Download A Free Copy of 100 Excel Tips & Tricks

excel tips and tricks ebook

We respect your privacy. We won’t spam you.

x