Apply Missing number Based on another Cell Value

hajiali

Well-known Member
Joined
Sep 8, 2018
Messages
626
Office Version
  1. 2016
Platform
  1. Windows
in cell B1 I have the following code:

Code:
=SMALL(IF(COUNTIF($A$1:$A$153,ROW($1:$153))=0,ROW($1:$153),""),ROW(A1))
and Pressed CTRL + SHIFT + ENTER


Where it finds the missing number in column A1:A153 However, I would like it to Display that value in B1 in C1 only if Sheet2!C(# thats missing) = "<>", otherwise check the next value. EX

SHEET 1
[TABLE="width: 100"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]5[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]6[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]8[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]10[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]11[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Right now the results would show as above but I want C1 to Check IF(Sheet2!C1= "<>",B1, Go to next value in column B) than to apply the B1 in C1 otherwise go to next value in column B. C2 to check Sheet2!C5 = "any Text" than value 5 in C2. C3 to check Sheet2!C6 =" " than Value 6 is not recorded in C3 to next check value Sheet2!C8 = "Any Text" than value 8 is in C3 . So the check Sheet2!C(# thats in column B)

Sheet 2
[TABLE="width: 100"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]3-15[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]4-16[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]OFF[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]8-15[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]OFF[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]ON[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]ON[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]OFF[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]ABC[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]13[/TD]
[/TR]
</tbody>[/TABLE]

So based on Sheet 2 above Sheet 1 Column C Results should be

SHEET 1
[TABLE="width: 100"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]1[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]5[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]6[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]8[/TD]
[TD]11[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]10[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]11[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I think I need to add a Vlookup or Index to the Above code just dont know how to make it work
 
Last edited:

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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