UDF to retrieve formula in target cell

Madhav

New Member
Joined
Feb 4, 2022
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi,

I need to create a custom VBA function to perform an operation similar to VLOOKUP.

I want to perform a search operation like VLOOKUP. But the only difference is, I need to retrieve the formula in the target cell instead of retrieving value in the cell, and I don't want to print the retrieved formula in the cell (like FORMULATEXT function), instead I want to paste it like 'paste special -> Formulas'.

Is this possible?

Or apart from creating UDF, is there any other way to do this?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Welcome to the Board!

Please post some specifics so that we can help you, i.e. a sampling of your data, where we can see that columns and rows everything is in, and where you want to return these results.

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.
 
Upvote 0
Welcome to the Board!

Please post some specifics so that we can help you, i.e. a sampling of your data, where we can see that columns and rows everything is in, and where you want to return these results.

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.

Hello,

Please find the attached image. The requirement is highlighted in green.

The expected solution is also mentioned in the screenshot. (Any other methods to solve this are also welcomed).

I'm not able to use XL2BB. So I'm attaching only screenshot.
 

Attachments

  • Screenshot.png
    Screenshot.png
    93.6 KB · Views: 15
Upvote 0
I am not sure what value column H plays, since it will always be “Pass” and it appears you are manually writing the formula dependent upon what is in column G. It seems to me that it is totally unnecessary (it is not telling you anything that you cannot already deduce from column G).

Why not just do a VLOOKUP in column C like this (for cell C3):
Excel Formula:
=IF(B3>=LEFT(VLOOKUP(A3,$F$3:$G$22,2,0),1),"Pass","Fail")
and copy down for all rows in column C?
 
Upvote 0
Solution
=IF(B3>=LEFT(VLOOKUP(A3,$F$3:$G$22,2,0),1),"Pass","Fail")

With this formula, I'm able to get the expected result.

Thank you.
 
Upvote 0
You are welcome.
Glad I was able to help!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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