SOLVED
Home

Excel Combination of IF and VLOOKUP

%3CLINGO-SUB%20id%3D%22lingo-sub-806488%22%20slang%3D%22en-US%22%3EExcel%20Combination%20of%20IF%20and%20VLOOKUP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-806488%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20want%20to%20connect%20the%20If%20formula%20and%20VLOOKUP%20formula.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20a%20sheet%20in%20which%20not%20every%20zip%20code%20is%20present%20but%20the%20Citys%20are.%3C%2FP%3E%3CP%3EI'm%20filling%20the%20gaps%20using%20a%20VLOOKUP%20and%20a%20second%20sheet%20with%20postal%20codes%20and%20citys%20as%20the%20matrix%3C%2FP%3E%3CP%3EBut%20since%20most%20citys%20have%20more%20than%20one%20zip%20code%20I%20don't%20want%20to%20drag%20the%20formula%20over%20the%20entire%20Data%20set.%20(That%20would%20change%20the%20present%20postal%20code%20to%20the%20one%20in%20my%20postal%20code%20sheet)%3C%2FP%3E%3CP%3EI%20had%20the%20Idea%20that%20I%20could%20combinate%20the%20VLOOKUP%20with%20an%20IF%20Formula.%20(IF%20cell%20is%20empty%20use%20VLOOKUP%20IF%20not%20keep%20Value)%3C%2FP%3E%3CP%3EIs%20that%20possible%20and%20If%20so%20how%20would%20that%20formula%20be%3F%26nbsp%3B%3C%2FP%3E%3CP%3EBest%20regards%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-806488%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EBI%20%26amp%3B%20Data%20Analysis%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-806505%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Combination%20of%20IF%20and%20VLOOKUP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-806505%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F392833%22%20target%3D%22_blank%22%3E%40Freezen%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%3C%2FP%3E%3CP%3EYes%20of%20course%20you%20can%20but%20instead%20of%20reinventing%20the%20sheet%2C%20would%20you%20please%20share%20either%20a%20sample%20Excel%20data%20or%20a%20snap%20shot%20with%20column%20Letters%20%26amp%3B%20Row%20Numbers%20to%20facilitate%20customizing%20the%20formula%20for%20your%20situation.%3C%2FP%3E%3CP%3EGood%20Luck%3C%2FP%3E%3CP%3ENabil%20Mourad%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-806512%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Combination%20of%20IF%20and%20VLOOKUP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-806512%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F392833%22%20target%3D%22_blank%22%3E%40Freezen%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20variant%20you%20may%20generate%20summary%20table%20with%20Power%20Query.%3C%2FP%3E%0A%3CP%3EIf%20with%20formulas%20you%20can't%20replace%20current%20value%20by%20formula.%20If%20only%20to%20add%20one%20more%20column%20where%20to%20put%20current%20or%20vlookup-ed%20value.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-806515%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Combination%20of%20IF%20and%20VLOOKUP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-806515%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F365248%22%20target%3D%22_blank%22%3E%40nabilmourad%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20Excel%20is%20in%20German%3B%20SVERWEIS%20is%20VLOOKUP%3B%20PLZ%20stands%20for%20ZIP%20Code%3B%20WENN%20is%20IF%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-806516%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Combination%20of%20IF%20and%20VLOOKUP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-806516%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F365248%22%20target%3D%22_blank%22%3E%40nabilmourad%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENabil%2C%20if%20I%20understood%20the%20logic%20correctly%2C%20that's%3C%2FP%3E%0A%3CP%3E%3CCELL%20value%3D%22%22%3E%3Dif%20%3CCELL%20value%3D%22%22%3E%3D%22%22%20then%20%3CANOTHER%20value%3D%22%22%3E%20else%20%3CCELL%20value%3D%22%22%3E%3C%2FCELL%3E%3C%2FANOTHER%3E%3C%2FCELL%3E%3C%2FCELL%3E%3C%2FP%3E%0A%3CP%3EHow%20that%20could%20work%20with%20formulas%20not%20considering%20iterative%20calculations%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-806522%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Combination%20of%20IF%20and%20VLOOKUP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-806522%22%20slang%3D%22en-US%22%3EThat%20would%20challenge%20my%20ongoing%20process%2C%20I'm%20using%20the%20Excel%20sheet%20later%20in%20combination%20with%20a%20Word%20text%20to%20generate%20series%20letters%20which%20I%20post%20as%20ads%20in%20job%20portal.%20I%20don't%20think%20I%20can%20fill%20in%20the%20postal%20code%20from%20two%20cell%20sources%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-806550%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Combination%20of%20IF%20and%20VLOOKUP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-806550%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F392833%22%20target%3D%22_blank%22%3E%40Freezen%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWith%20mail%20merge%20you%20may%20ignore%20your%20current%20PLZ%20column%20and%20use%20added%20one%2C%20let%20say%20PLZfilled%2C%20into%20which%20you%20add%20the%20post%20code%20from%20PLZ%20if%20not%20empty%2C%20otherwise%20the%20value%20returned%20by%20VLOOKUP.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-806712%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Combination%20of%20IF%20and%20VLOOKUP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-806712%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F392833%22%20target%3D%22_blank%22%3E%40Freezen%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20hear%20you%20Sergei%2C%20The%20issue%20also%20is%3A%20for%20each%20City%20we%20may%20have%20multiple%20Zip%20codes%20while%20each%20Zip%20code%20corresponds%20to%20one%20city.It%20wasn't%20clear%20to%20me%20weather%20the%20lookup%20value%20for%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F392833%22%20target%3D%22_blank%22%3E%40Freezen%3C%2FA%3E%26nbsp%3B%20will%20be%20the%20City%20or%20the%20Zip%20Code%2C%20that's%20why%20I%20asked%20for%20a%20sample.%20I%20was%20considering%20a%20helper%20column%20as%20well.%3C%2FP%3E%3CP%3EOn%20the%20other%20hand%2C%20I%20have%20a%20preference%20to%20the%20Power%20Query%20option%20but%20I%20always%20noticed%20(in%20my%20courses)%20that%20clients%20are%20fearful%20from%20PQ%20and%20have%20a%20tendency%20to%20Formulas...%20I%20don't%20know%20why%3F%20is%20it%20because%20formulas%20update%20without%20Refresh%3F%20may%20be!%3C%2FP%3E%3CP%3EHave%20a%20great%20day%20everyone.%3C%2FP%3E%3CP%3ENabil%20Mourad%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-807035%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Combination%20of%20IF%20and%20VLOOKUP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-807035%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F365248%22%20target%3D%22_blank%22%3E%40nabilmourad%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENabil%2C%3C%2FP%3E%0A%3CP%3EPower%20Query%20is%20a%20great%20tool%2C%20but%20that%20always%20a%20balance.%20Refresh%20is%20one%20point.%20Another%20one%20-%20people%20usually%20tend%20to%20combine%20data%20source%2C%20data%20preparation%20and%20reporting%20in%20one%20place%2C%20Power%20Query%20is%20more%20oriented%20on%20their%20separation%20(as%20it%20shall%20be).%20Formulas%20are%20more%20universal%2C%20in%20mixed%20Windows%2FMac%2Fmobile%2FOnline%20environment%20Power%20Query%20is%20less%20preferable.%3C%2FP%3E%0A%3CP%3EAnd%20I%20guess%20the%20main%20point%20one%20shall%20invest%20some%20time%20to%20understand%20how%20Power%20Query%20works%20and%20at%20least%20basic%20of%20M-script.%20With%20formulas%20you%20may%20copy%2Fpaste%20the%20pattern%2C%20adjust%20to%20your%20ranges%20and%20use%20it.%20Not%20so%20simple%20with%20Power%20Query%20if%20you%20never%20used%20it.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-809402%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Combination%20of%20IF%20and%20VLOOKUP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-809402%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20agree%20my%20friend%3C%2FP%3E%3C%2FLINGO-BODY%3E
Freezen
New Contributor

Hello,

 

I want to connect the If formula and VLOOKUP formula.

 

I have a sheet in which not every zip code is present but the Citys are.

I'm filling the gaps using a VLOOKUP and a second sheet with postal codes and citys as the matrix

But since most citys have more than one zip code I don't want to drag the formula over the entire Data set. (That would change the present postal code to the one in my postal code sheet)

I had the Idea that I could combinate the VLOOKUP with an IF Formula. (IF cell is empty use VLOOKUP IF not keep Value)

Is that possible and If so how would that formula be? 

Best regards

9 Replies

@Freezen 

Hi

Yes of course you can but instead of reinventing the sheet, would you please share either a sample Excel data or a snap shot with column Letters & Row Numbers to facilitate customizing the formula for your situation.

Good Luck

Nabil Mourad

Solution

@Freezen 

As variant you may generate summary table with Power Query.

If with formulas you can't replace current value by formula. If only to add one more column where to put current or vlookup-ed value.

@nabilmourad 

My Excel is in German; SVERWEIS is VLOOKUP; PLZ stands for ZIP Code; WENN is IF

@nabilmourad 

Nabil, if I understood the logic correctly, that's

<cell value>=if <cell value>="" then <another value> else <cell value>

How that could work with formulas not considering iterative calculations?

That would challenge my ongoing process, I'm using the Excel sheet later in combination with a Word text to generate series letters which I post as ads in job portal. I don't think I can fill in the postal code from two cell sources

@Freezen 

With mail merge you may ignore your current PLZ column and use added one, let say PLZfilled, into which you add the post code from PLZ if not empty, otherwise the value returned by VLOOKUP.

Highlighted

@Freezen 

@Sergei Baklan 

I hear you Sergei, The issue also is: for each City we may have multiple Zip codes while each Zip code corresponds to one city.It wasn't clear to me weather the lookup value for @Freezen  will be the City or the Zip Code, that's why I asked for a sample. I was considering a helper column as well.

On the other hand, I have a preference to the Power Query option but I always noticed (in my courses) that clients are fearful from PQ and have a tendency to Formulas... I don't know why? is it because formulas update without Refresh? may be!

Have a great day everyone.

Nabil Mourad

@nabilmourad 

Nabil,

Power Query is a great tool, but that always a balance. Refresh is one point. Another one - people usually tend to combine data source, data preparation and reporting in one place, Power Query is more oriented on their separation (as it shall be). Formulas are more universal, in mixed Windows/Mac/mobile/Online environment Power Query is less preferable.

And I guess the main point one shall invest some time to understand how Power Query works and at least basic of M-script. With formulas you may copy/paste the pattern, adjust to your ranges and use it. Not so simple with Power Query if you never used it.

@Sergei Baklan 

I agree my friend

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
38 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies