Can I use clean() with an array reference in index-match-match?

Erik the Awful

New Member
Joined
Feb 9, 2014
Messages
11
I built a spreadsheet for a coworker that takes data from a website and collates it into a nice sheet that's linked into a Powerpoint that is displayed at a weekly meeting. I have the sheet set up so that is uses index-match-match to pull specific values from an array on another sheet. Unfortunately, when the website generates its excel sheet (easily importable, but looks terrible), it sometimes includes extra spaces and carriage returns in the middle of the headers, which my sheet use to find the matches. How can I get the formula to strip the spaces and carriage returns from the cells it's comparing?

Macros are not an option.

My current formula is:
=IF(ISNA(INDEX('Data'!$E$7:$M$50,MATCH($A2,'Data'!$B$7:$B$50,0),MATCH(C$1,'Data'!$E$6:$M$6,0))),"",INDEX('Data'!$E$7:$M$50,MATCH($A2,'Data'!$B$7:$B$50,0),MATCH(C$1,'Data'!$E$6:$M$6,0)))

Changing "MATCH(C$1,'Data'!$E$6:$M$6,0)" to "MATCH(CLEAN(C$1),CLEAN('Data'!$E$6:$M$6),0)" doesn't work, and I really didn't expect it to. Currently my other option is to build a separate page to wash the data, and that feels too clunky for me.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Actually, since you want to apply CLEAN to an array of values, you'll need to confirm the formula with CONTROL+SHIFT+ENTER, not just ENTER. Also, you can use IFERROR to handle errors. Try...

=IFERROR(INDEX(Data!$E$7:$M$50,MATCH($A2,Data!$B$7:$B$50,0),MATCH(CLEAN(C$1),CLEAN(Data!$E$6:$M$6),0)),"")

...confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!
 
Upvote 0
I use index-match a lot, so I know to Ctrl+Shift+Enter, but for some reason your formula worked where mine failed. Thanks!
 
Upvote 0

Forum statistics

Threads
1,215,750
Messages
6,126,663
Members
449,326
Latest member
asp123

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