• 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
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

LOOKUP formula works in adjacent cells but fails in 2 cells??|General Excel Questions & Answers|Excel Forum|My Online Training Hub

You are here: Home / LOOKUP formula works in adjacent cells but fails in 2 cells??|General Excel Questions & Answers|Excel Forum|My Online Training Hub
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…LOOKUP formula works in adjacent ce…
sp_PrintTopic sp_TopicIcon
LOOKUP formula works in adjacent cells but fails in 2 cells??
Avatar
Brian Brockman

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
August 28, 2018
sp_UserOfflineSmall Offline
1
August 28, 2018 - 12:32 am
sp_Permalink sp_Print

Hi,

My first post, so please forgive me if I do something wrong.

I have been using this exact formula on a sheet and it works fine except on a few lines (cells): =IF(O4>0,(LOOKUP((MIN(G4:L4)), G4:L4, G$1:L$1))," ")

I have played with the formatting of all cells involved and nothing seems to work.

Any help would be appreciated.

LOOKUP-Capture.JPGImage Enlarger

Thank you,

brckwrth

sp_PlupAttachments Attachments
  • sp_PlupImage LOOKUP-Capture.JPG (35 KB)
Avatar
Frans Visser
Duivendrecht (near Amsterdam) - The Netherlands

VIP
Members
Level 2
Forum Posts: 346
Member Since:
April 21, 2015
sp_UserOfflineSmall Offline
2
August 28, 2018 - 3:03 am
sp_Permalink sp_Print

Hi Brian, welcome here at Mynda's Forum.

The difference I see in the values in the rows 4 and 5 (more exactly G4:L5) is they are maybe not values but text. The differ from the ones in the other rows, because there you have the $ amount also given.

So maybe formatting these cells wil solve your question?

Frans

Avatar
Brian Brockman

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
August 28, 2018
sp_UserOfflineSmall Offline
3
August 28, 2018 - 11:10 pm
sp_Permalink sp_Print

Hi Frans,

Thank you for your reply. 

However, I have tried every combination of formatting - Text, General, Accounting, Number ... etc.  Also copying the formats of the lines above and below.  All to no avail.

Also tried the Ctrl-Shift-Enter to add the parentheses brackets { }.

That did not work either.

Signed,

Stymied

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1515
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
4
August 29, 2018 - 8:51 am
sp_Permalink sp_Print

Hi Brian,

If you can supply the workbook it makes it easier to work out what is going wrong.

Regards

Phil

Avatar
SunnyKow
Puchong, Malaysia

VIP
Members


Trusted Members
Level 8
Forum Posts: 1432
Member Since:
June 25, 2016
sp_UserOfflineSmall Offline
5
August 29, 2018 - 11:10 am
sp_Permalink sp_Print

Hi Brian

LOOKUP requires the lookup vector (e.g. G2:L2) to be sorted in ascending order (which you can't do in your example), otherwise it may give you erroneous result.

I would suggest you use INDEX/MATCH instead of LOOKUP.

You can try this. In cell P2 enter =IF(O2>0,INDEX($G$1:$L$1,MATCH(MIN(G2:L2),G2:L2,0)),"")

Hope this helps.

Sunny

Avatar
Brian Brockman

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
August 28, 2018
sp_UserOfflineSmall Offline
6
August 29, 2018 - 11:18 pm
sp_Permalink sp_Print

Thank you very much Sunny!  Your INDEX formula worked !

Philip, I would still be curious to know why some of the LOOKUP Cells work and others don't.  So I've attached a version of the sheet here.

The sort order does not seem to matter on some of the successful lines. Lines 5, 7, 8 - for examples.

 

Anyway, thank you Myonlinetraininghub Community!

B

Avatar
Frans Visser
Duivendrecht (near Amsterdam) - The Netherlands

VIP
Members
Level 2
Forum Posts: 346
Member Since:
April 21, 2015
sp_UserOfflineSmall Offline
7
August 30, 2018 - 5:41 am
sp_Permalink sp_Print sp_EditHistory

Thanks for the sheet Brian. It helped to look for some faults. I worked some time with it and try to solve the problem, but didn't succeed. Even not with a new matrix with the same values.

I thought I found some things, but everytime the inconsistent working of the formula remained.

My documentation also said that this formula needs to have the data sorted, just as Sunny said. You seem to have good results in some lines, but when you enter for instance in a row that works good a lower value in a empty cell, you'll see that most of the times the same error is given. So it has to do with some inconsistency we can't reproduce exactly and therefore also not explain.

Fine that another formula works properly, so you can use that one!

Just one remark: you painted the cells with the highest and lowest values by hand. You better use conditional formatting for that!

Frans

Avatar
SunnyKow
Puchong, Malaysia

VIP
Members


Trusted Members
Level 8
Forum Posts: 1432
Member Since:
June 25, 2016
sp_UserOfflineSmall Offline
8
August 30, 2018 - 12:23 pm
sp_Permalink sp_Print

Hi Brian

Nice to know the formula is working for you.

LOOKUP (or VLOOKUP/HLOOKUP with the last argument TRUE/1/blank) does an approximate search for a value using a Binary search instead of a Sequential search.

Basically it compares your lookup value against the middle of the lookup vector to determine which side of the vector the lookup value it is located.

It will then continue to halve the lookup vector until it finds a value that is equal to or less than the lookup value.

If it fails to find one, it will give the #N/A error. Because of the Binary search, your lookup vector MUST be sorted otherwise the answer will be erratic.

You will get a correct answer in certain cases and not in another, depending on what your lookup array looks like.

Hope I am not confusing you Laugh.

Cheers

Sunny

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Riny van Eekelen, michael serna
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 870
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
A.Maurizio: 202
Jessica Stewart: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
michael serna
mashal sana
Tiffany Kang
Leah Gillmore
Sopi Yuniarti
LAFONSO HERNANDEZ
Hayden Hao
Angela chen
Sean Moore
John Chisholm
Forum Stats:
Groups: 3
Forums: 24
Topics: 6214
Posts: 27246

 

Member Stats:
Guest Posters: 49
Members: 31897
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.