How to incoporate some type of trim function to remove excessive white spaces to my formula

anhhua20

New Member
Joined
Nov 3, 2019
Messages
2
Dear all,

I would like to incorporate a function to trim excessive white spaces (i.e., >=2 white spaces in between words) into my pre-existing formula, but I'm at a loss for how to do this.
I've attached an excel sheet for your review. In my actual sheet, I have about 50 items, and each item is labeled with a specific stem word to distinguish the categories the items belong to but in the attached sheet, I've only included 2 items and they both belong to the same category of Objectives. Anyway, in these cells, my students can either enter a value of 0, 1, or text that says "Skipped with NA"), and the total possible number of points for these 2 items is 2. The participant gets credit for each item if they got a 1, or a "Skipped with NA".

The formula I've created states this: sum up all the values in columns where the headers contain the string of "Objectives_" AND add those cells where they have "Skipped with NA" entered in them. However, I want my current formula to be flexible enough so that if someone accidentally entered this text with extra white spaces in between the words, the participants would still get full credit for the item. So for example, for row #5, there are two white spaces between the word "Skipped" and the word "with", and I wanted the total score in column C to be 2, instead of 1.

I tried to insert a trim function in various locations in my formula but that did not work.

Can someone please kindly help? Thank you so much for your time, and please reach out if you need clarification.

Anita

How to remove excessive white spaces.xlsx
ABCD
12_Objectives_Item name3_Objectives_Item NameTotal ScoreDesired Outcome
2112This looks good
31Skipped with NA2This looks good
4101This looks good
51Skipped with NA1Desired Outcome is also 2
6Skipped with NA11Desired Outcome is also 2
Sheet1
Cell Formulas
RangeFormula
C2:C6C2=SUMIF($A$1:$B$1,"*Objectives_*",A2:B2)+COUNTIFS($A$1:$B$1,"*Objectives_*",A2:B2,"*Skipped with NA*")
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Hi,

You can do it this way with your existing formula, otherwise, we'll need to replace your COUNTIFS with SUMPRODUCT:

Book3.xlsx
ABCD
12_Objectives_Item name3_Objectives_Item NameTotal ScoreDesired Outcome
2112This looks good
31Skipped with NA2This looks good
4101This looks good
51Skipped with NA2Desired Outcome is also 2
6Skipped with NA12Desired Outcome is also 2
Sheet1016
Cell Formulas
RangeFormula
C2:C6C2=SUMIF($A$1:$B$1,"*Objectives_*",A2:B2)+COUNTIFS($A$1:$B$1,"*Objectives_*",A2:B2,"*Skipped*with*NA*")
 
Upvote 0
Solution
Wow... that was super clever and it requires very little change to my formula! Love it!

Thank you so much for your expertise!
Anita
 
Upvote 0
You're welcome, thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,632
Latest member
jladair

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