VLookup/IF formula

biglb79

Active Member
Joined
Oct 17, 2007
Messages
299
can someone please help me this formula? I'm using a VLookup to determine if column M should be labelled as Inpatient or Outpatient based on the program in column L. There is one program "PHP" that is outpatient, but it should be inpatient for three of the facilities and the facilities are listed in column A. They are labeled as ECC, ECI and ECS

hopefully that makes sense
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Can you post a sample of your data, formula, and expected output?

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

Also, I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
Can you post a sample of your data, formula, and expected output?

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

Also, I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
I think I finally figured it out

census sample file.xlsx
B
23
Census info
You need to select ALL the cells you want to copy/paste here before posting.
 
Upvote 0
You need to select ALL the cells you want to copy/paste here before posting.
ah! here you go

census sample file.xlsx
ABCDEGHIJKLM
16B/U CodeProgramInpatient/Outpatient
17RiverADULT PSYCH
18ECIDetox
19ECIRTC
20ECIRTC
21ECIRTC
22ECIRTC
23ECIDetox
24ClearADULT PSYCH
25ClearADULT PSYCH
26ClearADULT PSYCH
27ClearGERI PSYCH
28ClearADULT PSYCH
29ECSPHP
30ECSRTC
31ECSRTC
32ECSPHP
33ECSRTC
34SunADULT PSYCH
35SunADULT PSYCH
36SunADULT PSYCH
37SunADULT PSYCH
38SunADULT PSYCH
39SunADULT PSYCH
40SunADULT PSYCH
41SunGERI PSYCH
42SunMH IOP
43ECCPHP
44ECCRTC
45ECCPHP
46ECCPHP
Census info


census sample file.xlsx
AB
1ProgramIP/OP?
2ADULT PSYCHInpatient
3AssessmentInpatient
4DetoxInpatient
5GERI PSYCHInpatient
6IOPOutpatient
7MH IOPOutpatient
8MH PHPOutpatient
9OutpatientOutpatient
10PHPOutpatient
11RTCInpatient
Vista census key
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B1:B11Cell Value=#REF!textNO
 
Upvote 0
I see. That makes much more sense now, thanks.

Try this formula in cell M17 and copy down for all rows:
Excel Formula:
=IF(AND(L17="PHP",OR(A17="ECC",A17="ECI",A17="ECS")),"Inpatient",VLOOKUP(L17,'Vista census key'!$A$2:$B$11,2,0))
 
Upvote 0
Solution
I see. That makes much more sense now, thanks.

Try this formula in cell M17 and copy down for all rows:
Excel Formula:
=IF(AND(L17="PHP",OR(A17="ECC",A17="ECI",A17="ECS")),"Inpatient",VLOOKUP(L17,'Vista census key'!$A$2:$B$11,2,0))
perfect!! thanks so much!
 
Upvote 0
You are welcome.
Glad I was able to help!

If you break it down, you can see all that I did was first look for your "special" condition, and if found, populate "Inpatient". Otherwise, do the normal VLOOKUP.
 
Upvote 0

Forum statistics

Threads
1,215,268
Messages
6,123,965
Members
449,137
Latest member
yeti1016

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top