SOLVED

New Contributor

# HLOOKUP looking for a value that is the result of a formula

Hello,

This is my 'Coef_Table':

 half day shifts 1 2 3 4 5 6 7 1 0.256 0.472 0.985 1.347 0.639 1.665 0.398 2 1.854 0.524 0.658 1.474 0.574 1.214 1.658

In another table:

 date half coeficient 01/01/2011 1 =HLOOKUP(WEEKDAY(A2);'Coef_Table!A1:H3';(B2+1);FALSE) 01/02/2011 2 =HLOOKUP(WEEKDAY(A3);'Coef_Table!A1:H3';(B3+1);FALSE) 01/03/2011 1 =HLOOKUP(WEEKDAY(A4);'Coef_Table!A1:H3';(B4+1);FALSE)

HLOOKUP does not lookup for the value returned by WEEKDAY() and aldo does not respect the line number argument as a result of 'half+1'

Is there a way to pass arguments to HLOOKUP as results of formulas?

4 Replies

# Re: HLOOKUP looking for a value that is the result of a formula

@mlohmann Yes you can. Just make sure that the numbers in the top of the Coef_Table are real numbers and not texts.

# Re: HLOOKUP looking for a value that is the result of a formula

@Riny_van_Eekelenthanks for your answer, but this is not working even tho the numbers in the first line of the table are real numbers. In fact, if I replace the formula with a typed value it works! I can even format the values with trailing decimal zeros, just to confirm they are real numbers, but as soon as I get the value from a formula the lookup fails.
I also tryed to externalize the formula, putting into C2 [=WEEKDAY(A2)] then LookUp for C2 instead of the formula, and it still returns #N/A

best response confirmed by Grahmfs13 (Microsoft)
Solution

# Re: HLOOKUP looking for a value that is the result of a formula

@mlohmann I copied your example date into an empty sheet and entered your formula as well and all seems to work OK, provided that you remove the apostrophes surrounding the range to 'Coef_Table!A1:H3', and make the reference to A1:H3 absolute. If you insist to use apostrophes the need to surround the sheet name only. Do include the cell ranges.

See attached for a working example.

# Re: HLOOKUP looking for a value that is the result of a formula

Thanks again for your answer and example! I see it working but I can´t see the difference in my file. The apostrophes surrounding the range were just in the smal sample I typed here, It was correctly surrounding the sheet name only within the actual formula, since it was placed automaticaly by excel (sorry I mistyped here). I´ll review the whole thing then, since your example works fine, there is surrely something in my data!

Best regards!