Need Custom Function to Format Cell Values

Alex20850

Board Regular
Joined
Mar 9, 2010
Messages
146
Office Version
  1. 365
Platform
  1. Windows
I have values on a source sheet and a working sheet.

On the working sheet, I pull values from matching cells (Working!B6 gets the value from Source!B6 etc.) I need a custom function which looks at a cell such as Working!B1 to decide what to do in Working!B6:

If it is V or D, then add an apostrophe to be beginning and an apostrophe and comma at the end of Working!B6
If it is N, no apostrophe, but still a comma at the end.

In this case, I would use B$1 in the function, so I can copy it down and across with it adjusting for the different columns and rows.
 
Last edited:

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Hi Alex20850,

This will put the apostrophe around the entry if the text is V or D or else it won't (hopefully this is what you need):

=IF(OR(Source!A2="V",Source!A2="D"),"'"&Source!A2&"',",Source!A2&",")

Robert
 
Upvote 0
This will put the apostrophe around the entry if the text is V or D or else it won't (hopefully this is what you need):

=IF(OR(Source!A2="V",Source!A2="D"),"'"&Source!A2&"',",Source!A2&",")
It is not completely clear to me whether your sheet references should be to "Source" or "Working" although I kind of think it should be "Working". No matter which, I am pretty sure the cell addresses I highlighted in red should both be B6, not A2.
 
Upvote 0
You are correct. The basic formula is enough for me to work with. Thanks
 
Upvote 0

Forum statistics

Threads
1,224,986
Messages
6,182,154
Members
453,093
Latest member
Soffy

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