Removing unintentional spaces when assembly multiple texts based on IF's

helloworld_2022

New Member
Joined
Jun 8, 2022
Messages
2
Office Version
  1. 2019
  2. 2016
Platform
  1. MacOS
Hi everyone,

I want to remove any unintentional spacings in my formula, when visible in the cell.
The formula is af following:

Excel Formula:
=A82&" "&'Work Order (Client)'!D46&" "& "on commission (pre-payment)"&""&IF('Input sheet'!B31="Proteomics";",";"")&""&IF('Input sheet'!B31="Proteomics";G113;"")&""&IF('Input sheet'!C31="Metabolomics";",";"")&" "&IF('Input sheet'!C31="Metabolomics";G114;"")&""&IF('Input sheet'!E31="Transcriptomics";",";"")&"  "&IF('Input sheet'!E31="Transcriptomics";G115;"")&""&IF('Input sheet'!G31="Laser-microdissection";",";"")&" "&IF('Input sheet'!G31="Laser-microdissection";G116;"")&""&"."

You can find the result attached as an image. The issue is, let's say that I don't have WP Proteomics and WP Metabolomics; there is a spacing between the commas and the previous sentence, and the more IF's that exclude a text, the more spacing (see the other attachment). I could just put in a comma after each sentence, but then it will not necessarily end with a dot if it's the last IF selected in the sequence.

I'm looking forward to hearing your suggestions.

Kindly,
Louis
 

Attachments

  • Screen Shot 2022-06-08 at 09.54.39.png
    Screen Shot 2022-06-08 at 09.54.39.png
    77.5 KB · Views: 21
  • Screen Shot 2022-06-08 at 09.59.45.png
    Screen Shot 2022-06-08 at 09.59.45.png
    53.1 KB · Views: 16

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
I've tried to use Text Trim, but it only removed one of the two spacings (where it double-spaces).
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,197
Members
453,022
Latest member
RobertV1609

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