What is the best formula to use?

%3CLINGO-SUB%20id%3D%22lingo-sub-2195234%22%20slang%3D%22en-US%22%3EWhat%20is%20the%20best%20formula%20to%20use%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2195234%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20everyone%2C%3C%2FP%3E%3CP%3EI%20have%20a%20project%20for%20work%20that%20I%20need%20help%20with.%20I%20have%20a%20macro%20pulling%20data%20from%20an%20external%20database%2C%20and%20I%20need%20to%20find%20a%20formula%20that%20will%20say%20if%20column%20a%20%3D%20blank%2C%20then%20return%20the%20next%20cell%20to%20the%20right%20of%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAt%20first%20I%20tried%20an%20IF%20THEN%20statement%20but%20got%20nowhere.%20So%20then%2C%20I%20figured%20the%20easiest%20would%20be%20a%20VLOOKUP%2C%20but%20it%20isn't%20working%20either%20and%20returns%20an%20%23N%2FA.%20So%2C%20I%20added%20a%20screenshot%20of%20an%20example%20of%20the%20formula%20I%20was%20trying.%20What%20am%20I%20doing%20wrong%20or%20is%20there%20an%20easier%20way%20to%20do%20this%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20other%20thing%20is%20that%20there%20are%20spaces%20in%20between%20each%20row%20(that%20are%20not%20shown%20below)%20in%20my%20spreadsheet%20because%20the%20rows%20change%20in%20the%20data%20I'm%20pulling.%20What%20may%20have%20been%20in%20B3%20today%20may%20be%20in%20B7%20tomorrow.%20That%20is%20why%20I'm%20am%20needing%20to%20figure%20this%20out.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20formula%20should%20be%20saying%2021%2C%20but%20it%20is%20saying%20%23N%2FA%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22catherine9910_1-1615275556247.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F261891i8A2DBD84BC5338CE%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22catherine9910_1-1615275556247.png%22%20alt%3D%22catherine9910_1-1615275556247.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2195234%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2195322%22%20slang%3D%22en-US%22%3ERe%3A%20What%20is%20the%20best%20formula%20to%20use%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2195322%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F888027%22%20target%3D%22_blank%22%3E%40catherine9910%3C%2FA%3E%26nbsp%3BAssuming%20that%20the%2010%20in%20column%20B%20is%20number.%20If%20so%2C%20remover%20the%20quotation%20marks%20around%20the%2010%20in%20your%20formula%2C%20as%20it%20tries%20to%20match%20a%20text%20with%20a%20number%20and%20can't.%20Hence%2C%20%23N%2FA.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEven%20better%20to%20replace%20the%20%2210%22%20in%20your%20formula%20with%20a%20reference%20to%20F3%20and%20make%20the%20reference%20to%20the%20lookup%20range%20absolute%2C%20i.e.%20by%20putting%20%24%20signs%20in%20front%20of%20each%20column%20and%20row%20reference.%20Or%20create%20a%20named%20range%20or%20structured%20table%20of%20your%20data.%20Sorry%2C%20for%20offering%20all%20the%20different%20options%2C%20but%20there%20are%20many%20way%20to%20tackle%20things%20in%20Excel.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi everyone,

I have a project for work that I need help with. I have a macro pulling data from an external database, and I need to find a formula that will say if column a = blank, then return the next cell to the right of it.

 

At first I tried an IF THEN statement but got nowhere. So then, I figured the easiest would be a VLOOKUP, but it isn't working either and returns an #N/A. So, I added a screenshot of an example of the formula I was trying. What am I doing wrong or is there an easier way to do this?

 

The other thing is that there are spaces in between each row (that are not shown below) in my spreadsheet because the rows change in the data I'm pulling. What may have been in B3 today may be in B7 tomorrow. That is why I'm am needing to figure this out.

 

The formula should be saying 21, but it is saying #N/A

 

catherine9910_1-1615275556247.png

 

 

3 Replies

@catherine9910 Assuming that the 10 in column B is number. If so, remover the quotation marks around the 10 in your formula, as it tries to match a text with a number and can't. Hence, #N/A.

 

Even better to replace the "10" in your formula with a reference to F3 and make the reference to the lookup range absolute, i.e. by putting $ signs in front of each column and row reference. Or create a named range or structured table of your data. Sorry, for offering all the different options, but there are many way to tackle things in Excel.

No, I like that you have given me multiple options to try that way I can find the best one for my project. Thank you.
remove quotations in 10 as this is number, then it should work