#N/A Values

c0087

Board Regular
Joined
Jul 13, 2015
Messages
94
Office Version
  1. 365
Platform
  1. Windows
[TABLE="width: 500"]
<tbody>[TR]
[TD]1[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]#N/A[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]#N/A[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]#N/A[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I have a bunch of #N/A values in columns. what's the easiest way to get the desired result (1234) in the adjacent column with no empty cells in between?
 
Last edited:

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
How about


Book1
AB
211
3#N/A2
4#N/A3
524
63
7#N/A
84
Master
Cell Formulas
RangeFormula
B2=IFERROR(INDEX($A$2:$A$8,AGGREGATE(15,6,(ROW($A$2:$A$8)-ROW($A$2)+1)/($A$2:$A$8<>"#N/A"),ROWS($A$1:$A1))),"")
 
Upvote 0
I'm not sure there is any way to characterize the "easiest way". If you do not need the data in Column B to be "live" (that is, changeable as values in Column A change), then this macro will avoid loading up the sheet with formulas...
Code:
Sub DeleteNAs()
  Columns("A").Copy
  Range("B1").PasteSpecial xlValues
  Columns("B").SpecialCells(xlConstants, xlErrors).Delete xlShiftUp
End Sub
 
Upvote 0
How about

AB

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]2[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]#N/A[/TD]
[TD="align: right"]2[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]#N/A[/TD]
[TD="align: right"]3[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]4[/TD]

[TD="align: center"]6[/TD]
[TD="align: right"]3[/TD]

[TD="align: center"]7[/TD]
[TD="align: right"]#N/A[/TD]

[TD="align: center"]8[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"][/TD]

</tbody>
Master

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]B2[/TH]
[TD="align: left"]=IFERROR(INDEX($A$2:$A$8,AGGREGATE(15,6,(ROW($A$2:$A$8)-ROW($A$2)+1)/($A$2:$A$8<>"#N/A"),ROWS($A$1:$A1))),"")[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

this formula gets rid of the N/A's but leaves an empty cell
 
Upvote 0
I'm not sure there is any way to characterize the "easiest way". If you do not need the data in Column B to be "live" (that is, changeable as values in Column A change), then this macro will avoid loading up the sheet with formulas...
Code:
Sub DeleteNAs()
  Columns("A").Copy
  Range("B1").PasteSpecial xlValues
  Columns("B").SpecialCells(xlConstants, xlErrors).Delete xlShiftUp
End Sub

Thank you this works perfect if I do decide to go that route, but I'd still rather a formula for now.
 
Last edited:
Upvote 0
It doesn't leave any empty cells for me.
Can you please post some data where you are getting blank cells
 
Upvote 0
Hi Fluff, Hi Rick,

How you been. A quick question. How about considering "Sort option" as the easiest way to get the desired result. :)
 
Upvote 0
How you been. A quick question. How about considering "Sort option" as the easiest way to get the desired result. :)
First, you would have to copy Column A values to Column B and then sort Column B as the OP wants the answer in the "adjacent column". Second, I assume you are implying to then select all of the #N/A cells and delete those cells (shifting the remaining values up). Yes, that might work depending on if the current order of the values needs to be maintained or not (the solutions so far preserves the current order whereas your suggestion would change their order).
 
Upvote 0
It doesn't leave any empty cells for me.
Can you please post some data where you are getting blank cells

i made an error when copying in it :mad:..

it works perfect! thank you so much
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,191
Members
452,616
Latest member
intern444

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