IF with a ASNA and a VLOOKUP combination formula

pook_666

Board Regular
Joined
Aug 16, 2018
Messages
63
Hi magicians!

I have two formulas that I want to make into one, if at all possible:

Formula one:
Excel Formula:
=IF(ISNA(VLOOKUP(A2&B2,'Sheet1'!A:E,5,FALSE)),F2,VLOOKUP(A2&B2,'Sheet1'!A:E,5,FALSE))

Formula two:
Excel Formula:
=IF('Sheet1'!E2="Yes",H3*2,H3)

What I am trying to do is:
1 - vlookup A2&B2 against Sheet1 A:E
2 - if it exists, then within that vlookup table, if the value in column E is "Yes" then multiply H3*2 and if the answer is "No" simply produce H3 value.
3 - if doesn't exist, produce F2 value

So I kind of need to replace the "5" within the vlookup with formula 2? Bit weird I know, but is there anyway I can combine these into just one cell? Thanks!
 

Some videos you may like

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

FormR

MrExcel MVP
Joined
Aug 18, 2011
Messages
6,464
Office Version
  1. 365
Platform
  1. Windows
Hi, how about.

=IFNA(IF(VLOOKUP(A2&B2,Sheet1!A:E,5,FALSE)="Yes",H3*2,H3),F2)
 
Solution

pook_666

Board Regular
Joined
Aug 16, 2018
Messages
63
Sorry - I tried just putting this into my VBA code and it doesn't like "Yes" in the formula as I get the "expected end of statement" error....if I change to 'Yes' in VBA then it doesn't work in my cell. Do you know how to change the "Yes"?

VBA code is below if needed:

VBA Code:
Range("I2").Formula = "=IFNA(IF(VLOOKUP(A2&B2,'Sheet1'!A:E,5,FALSE)='Yes',(H2/2*F2),(H2*F2)),(H2*F2))"
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
47,926
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

You have to double-up the quote marks so change "Yes" to ""Yes""
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
47,926
Office Version
  1. 365
Platform
  1. Windows
Cheers. No problem. (y)
 

Watch MrExcel Video

Forum statistics

Threads
1,122,241
Messages
5,595,017
Members
413,960
Latest member
ikkin

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
Top