If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Vlookup and if

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-01-10, 10:00
waylander waylander is offline
Registered User
 
Join Date: Apr 2006
Posts: 52
Vlookup and if

please consider the following formula, it returns a 'Yes' or 'No' from a Vlookup return depending if the record is a string 'True' or 'False'

=IF(VLOOKUP(A5,'Z:\Information Analysis\CSP Study Log Development\CSP Reporting\Excel Solution\[CSPProject.xls]Sheet1'!A:N,13,FALSE),"YES","NO")

However i have noticed that there are some blank cells in the data in which it is still returned as a 'No'. Can anyone please advise how to alter this to return a 'Not Assigned' if the cell is blank?

many thanks
Reply With Quote
  #2 (permalink)  
Old 03-01-10, 10:59
Colin Legg Colin Legg is offline
Registered User
 
Join Date: Sep 2008
Location: London, UK
Posts: 495
Try this (untested):

=IF(VLOOKUP(A5,'Z:\Information Analysis\CSP Study Log Development\CSP Reporting\Excel Solution\[CSPProject.xls]Sheet1'!A:N,13,FALSE),"YES",IF(VLOOKUP(A5,'Z:\Info rmation Analysis\CSP Study Log Development\CSP Reporting\Excel Solution\[CSPProject.xls]Sheet1'!A:N,13,FALSE)="","Not Assigned","NO"))




It's quite a long formula so I'd be tempted to use a helper column instead.
In the helper column you could simply look up the value:
=VLOOKUP(A5,'Z:\Information Analysis\CSP Study Log Development\CSP Reporting\Excel Solution\[CSPProject.xls]Sheet1'!A:N,13,FALSE)

Then you can reference the helper column with the IF() conditions. Say the helper column is column B:
=IF(B5,"YES",IF(B5="","Not Assigned","NO"))



Also, I notice you are returning the value from the 13th column. If that's the case the lookup table can be reduced to A:M rather than A:N.

Hope that helps...
__________________
Colin

RAD Excel Blog

Other tutorials:
Array Formulas | Deleting Rows with VBA
Reply With Quote
  #3 (permalink)  
Old 03-01-10, 11:58
waylander waylander is offline
Registered User
 
Join Date: Apr 2006
Posts: 52
Hi Colin,
your first suggestion has the same outcome as my formula i.e if blank it returns a 'No'

I have tried the helper column example and the same applies since the returned value oin the helper column is either 'TRUE', 'FALSE' or '0', (the Vlookup returns a 0 from the blank cell)

the formula then interprets the 0 as a false thus returns a 'No'

thanks
Reply With Quote
  #4 (permalink)  
Old 03-01-10, 12:04
waylander waylander is offline
Registered User
 
Join Date: Apr 2006
Posts: 52
hi Colin,
i just realised all i have to do is use the helper and make the formula look like this

=IF(B5,"YES",IF(B5=0,"Not Assigned","NO"))
Reply With Quote
  #5 (permalink)  
Old 03-01-10, 12:12
Colin Legg Colin Legg is offline
Registered User
 
Join Date: Sep 2008
Location: London, UK
Posts: 495
Hi,

Sorry about that - I didn't test it and I didn't consider the coercion issue.

Yes, good work. Provided that column M contains boolean TRUE/FALSE values rather than string "TRUE"/"FALSE" values, an alternative might also be:

=IF(ISLOGICAL(B5),IF(B5,"YES","NO"),"Not Assigned")
__________________
Colin

RAD Excel Blog

Other tutorials:
Array Formulas | Deleting Rows with VBA
Reply With Quote
  #6 (permalink)  
Old 03-01-10, 12:16
waylander waylander is offline
Registered User
 
Join Date: Apr 2006
Posts: 52
Hi Colin,

actually both methods work, i realised i wasn't applying correct references to the first one,

apologies and many thanks for your help
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On