Substitute function to remove blank spaces

ChristineJ

Well-known Member
Joined
May 18, 2009
Messages
761
Office Version
  1. 365
Platform
  1. Windows
I am using the substitute function to remove blank spaces in strings of text in cells AD187 and AD191, as follows:

In cell AD187
Code:
=SUBSTITUTE(C188," ","")&IF(I188="","x",I188)&IF(K188="","x",K188)&SUBSTITUTE(C189," ","")&IF(I189="","x",I189)&IF(K189="","x",K189)&SUBSTITUTE(C190," ","")&IF(I190="","x",I190)&IF(K190="","x",K190)&SUBSTITUTE(C191," ","")&IF(I191="","x",I191)&IF(K191="","x",K191)

In cell AD191
Code:
=AD188&AA188&"x"&SUBSTITUTE(AD189," ","")&"x"&AA189&SUBSTITUTE(AD190," ","")&"x"&AA190&"xx"

I need to compare the two results to see if they are the same, and am using if(AD187=AD191,444,0) to do so. It returns a 0 as if they are not the same, even when they are. Both cells show Cash612000xCommonStockx340000Paid-inCapitalinExcelssofPar-CommonStockx272000 What do I need to change in my formulas so that when compared with this IF function a 444 is returned?

However, if I copy the VALUES from AD187 and AD191 to other cells and use an IF function to compare them, it returns 444, indicating they do match one another.

Thanks!
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Hard to tell without knowing exactly what is in all the precedent cells ( C188, I188, ...... , AA190)
 
Upvote 0
Post the spreadsheet, remove any sensitive data, create a mockup example if necessary.

You cant attach files on this forum.
Uupload the file to an online storage site and post a link to it, though some people may not download the file for fear of viruses.
 
Last edited:
Upvote 0
Yes, sorry to be unclear on that. As I was typing my response to you I had an idea and tried it - it worked!

Thanks for being willing to help me.
 
Upvote 0

Forum statistics

Threads
1,214,992
Messages
6,122,631
Members
449,095
Latest member
bsb1122

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