Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-08-2016, 01:33 PM
ljg713 ljg713 is offline Finding the nth Blank Value in a Row of Text Windows 7 64bit Finding the nth Blank Value in a Row of Text Office 2010 64bit
Novice
Finding the nth Blank Value in a Row of Text
 
Join Date: Dec 2015
Posts: 20
ljg713 is on a distinguished road
Default Finding the nth Blank Value in a Row of Text

I have a row of text (not sure if this is relevant, but the text isn't purely typed, it is a formula of concatenations and if statements).

Some cells appear blank (although they still have the same ifelse/concatenation formula, but end up being "")

So, basically I have a row of formulaic text that looks like this

A1 B1 C1 D1 E1 F1 G1 H1 I1 J1

I want to use the range E1 through H1, and write a formula in a different worksheet that will order these by non-blank cells. So, I need to find the first nonblank cell, 2nd nonblank cell, 3rd, and 4th. Because some of these cells are blank, not all 4 of the spots will be fill, but the formula needs to make sure that if there is text in all of them then it will fill in order.




=IF(COUNTIF(E1:H1,"?*")>=2,INDEX(E1:H1,SMALL(IF(E1 :H1<>"",COLUMN(E1:H1)-COLUMN(E1)+1),1)),"") (for the first nonblank)

=IF(COUNTIF(E1:H1,"?*")>=2,INDEX(E1:H1,SMALL(IF(E1 :H1<>"",COLUMN(E1:H1)-COLUMN(E1)+1),2)),"") (for the 2nd nonblank), etc.

I have been trying this array formula, and it works for finding the first two non-blank text values, but when I try to find the 3rd and 4th nonblank values, if there is a blank value, instead of just a blank I am getting #NUM!.

Any ideas?
Reply With Quote
  #2  
Old 01-09-2016, 01:19 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Finding the nth Blank Value in a Row of Text Windows 7 64bit Finding the nth Blank Value in a Row of Text Office 2010 64bit
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,769
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

Just to be sure I understand, a blank cell is always a cell containing a null text string ? ("")
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
  #3  
Old 01-09-2016, 05:48 AM
xor xor is offline Finding the nth Blank Value in a Row of Text Windows 10 Finding the nth Blank Value in a Row of Text Office 2013
Expert
 
Join Date: Oct 2015
Posts: 1,097
xor is a name known to allxor is a name known to allxor is a name known to allxor is a name known to allxor is a name known to allxor is a name known to all
Default

Name A1:J1 as d and use the matrix formula:

=IFERROR(INDEX(d,SMALL(IF(d<>"",COLUMN(d)-CELL("col",d)+1),COLUMNS($E:E))),"")

for listing the first non-blank text. Copy the formula to the right to list second, third etc. non-blank text.

If you do not want to use IFERROR, you can instead use:

=IF(COLUMNS($E:E)>SUM(--(d<>"")),"",INDEX(d,SMALL(IF(d<>"",COLUMN(d)-CELL("col",d)+1),COLUMNS($E:E))))
Reply With Quote
  #4  
Old 01-11-2016, 07:21 AM
ljg713 ljg713 is offline Finding the nth Blank Value in a Row of Text Windows 7 64bit Finding the nth Blank Value in a Row of Text Office 2010 64bit
Novice
Finding the nth Blank Value in a Row of Text
 
Join Date: Dec 2015
Posts: 20
ljg713 is on a distinguished road
Default

Quote:
Originally Posted by Pecoflyer View Post
Just to be sure I understand, a blank cell is always a cell containing a null text string ? ("")
Yep, that is Correct.
Reply With Quote
  #5  
Old 01-11-2016, 07:28 AM
ljg713 ljg713 is offline Finding the nth Blank Value in a Row of Text Windows 7 64bit Finding the nth Blank Value in a Row of Text Office 2010 64bit
Novice
Finding the nth Blank Value in a Row of Text
 
Join Date: Dec 2015
Posts: 20
ljg713 is on a distinguished road
Default

Quote:
Originally Posted by xor View Post
Name A1:J1 as d and use the matrix formula:

=IFERROR(INDEX(d,SMALL(IF(d<>"",COLUMN(d)-CELL("col",d)+1),COLUMNS($E:E))),"")

for listing the first non-blank text. Copy the formula to the right to list second, third etc. non-blank text.

If you do not want to use IFERROR, you can instead use:

=IF(COLUMNS($E:E)>SUM(--(d<>"")),"",INDEX(d,SMALL(IF(d<>"",COLUMN(d)-CELL("col",d)+1),COLUMNS($E:E))))

Thanks for the reply! However, none of these equations works for me. The first one allows me to enter the formula, but the cell is blank, whereas I would like a formula that when entered in four consecutive cells gives me the first four nonblank text cells within the range I specified.

The second column won't allow me to enter it all due to some sort of error :/
Reply With Quote
  #6  
Old 01-11-2016, 07:50 AM
ljg713 ljg713 is offline Finding the nth Blank Value in a Row of Text Windows 7 64bit Finding the nth Blank Value in a Row of Text Office 2010 64bit
Novice
Finding the nth Blank Value in a Row of Text
 
Join Date: Dec 2015
Posts: 20
ljg713 is on a distinguished road
Default

I decided that my original answer works well, except for one issue.

=IF(COUNTIF(E1:H1,"?*")>=2,INDEX(E1:H1,SMALL(IF(E1 :H1<>"",COLUMN(E1:H1)-COLUMN(E1)+1),1)),"") (for the first nonblank)

gives me what I want, but it needs to return a blank if there is no text to be returned (for example, if a particular row only has 3 non-blank text cells, it needs to still work for the 4th non-blank but just return "" so it appears blank). Instead, in the cases where there isn't any text to be returned, I get a #NUM! error.

Any tips for how to get rid of this error and replace it with empty text like ""?

Thanks!
Reply With Quote
  #7  
Old 01-11-2016, 08:46 AM
xor xor is offline Finding the nth Blank Value in a Row of Text Windows 10 Finding the nth Blank Value in a Row of Text Office 2013
Expert
 
Join Date: Oct 2015
Posts: 1,097
xor is a name known to allxor is a name known to allxor is a name known to allxor is a name known to allxor is a name known to allxor is a name known to all
Default Finding the nth Blank Value in a Row of Text

My formulas work fine.
Attached Files
File Type: xlsx ListWithoutBlanks.xlsx (9.7 KB, 24 views)
Reply With Quote
  #8  
Old 01-12-2016, 07:49 AM
ljg713 ljg713 is offline Finding the nth Blank Value in a Row of Text Windows 7 64bit Finding the nth Blank Value in a Row of Text Office 2010 64bit
Novice
Finding the nth Blank Value in a Row of Text
 
Join Date: Dec 2015
Posts: 20
ljg713 is on a distinguished road
Default

Thank you!
Reply With Quote
Reply

Tags
formula help

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding the nth Blank Value in a Row of Text finding a string containing a combination of formats and adding text before Marco Word VBA 1 11-02-2015 05:08 PM
Finding the nth Blank Value in a Row of Text Finding and Replacing a word with text copied to clip board spc94 Word VBA 3 06-25-2015 04:46 AM
Finding varying text in an MS Word file sergiodcq Word 1 07-08-2014 03:12 AM
Finding specific text within body of email Tammfran Outlook 0 03-14-2014 02:32 PM
Finding a text style in a cell jimbassett Excel 1 02-10-2010 08:39 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:03 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft