Avatar of Nirvana
Nirvana
Flag for India asked on

excel formula or VBA

I have two Columns in EXCEL

below are the scenarios i have to cover in the formula
  1. IF I have data in Col A that have to updated in Column D
  2. If I have Zero in Column A then do a vlookup based on Column C in Sheet2 and pick update results of column 5
  3. even after vlookup if i do not find anything Column D have to be updated with Column B
  4. in Column A if i have the rows contain FUSE DB then col B have to picked
  5. Delete Fuse db word in results column

I know this is little confusing I am attaching a sample file
How can i have formula or macro to do everythin in one column
sample1.xlsx
Microsoft ExcelVBA

Avatar of undefined
Last Comment
Nirvana

8/22/2022 - Mon
NBVC

Try in column A:

=IFERROR(VLOOKUP(C2,Sheet2!$A$2:$E$6,5,0),B2)

copied down.

I think you are also talking about the formula in column D.  It looks like you had and \ in the formula causing error:

s/b =IF(A2="FUSE DB",B2,A2)

Does this cover your request?
Nirvana

ASKER
Thank you so much, just few changes

1. If i get a result as "Fuse DB" in Col "D" then it have to be treated as blank

which means after execute the below formula and if stil get "Fuse DB" it have to cosider ""(Blank)

=IFERROR(VLOOKUP(C2,Sheet2!$A$2:$E$6,5,0),A2)

2. If my Column "D' is zero and Column Has "Fuse DB" only then this Formula if I have data in Columd then Col E have to be blank

=IF(A2="FUSE DB",B2,A2)

In a nut shell i either have to have data in Col D or Col E
NBVC

For part 1, try

=IF(VLOOKUP(C2,Sheet2!$A$2:$E$6,5,0)="Fuse DB","",IFERROR(VLOOKUP(C2,Sheet2!$A$2:$E$6,5,0),A2)

for part 2, our description got a little confusing...  can you elaborate on that.

I did notice that the 0 in column A is text, so the current formula in column C should have the 0 in quotes...

=IF(A2="0",C2,A2)  

copied down.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Nirvana

ASKER
for part 1 i am getting an error and i have attached file with changes highlighted in red. Hope I am clear. Thank you so much for your time
sample1.xlsx
ASKER CERTIFIED SOLUTION
NBVC

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
NBVC

and change G2 to:

=IF(A2="FUSE DB",B2,A2) to remove the #NA error
Nirvana

ASKER
Thank you so much. is there any way i can put it as a macro formula gets copy pasted based on the active cells in Col A?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.