Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default IF and HLOOKUP Formula

Sorry about the first request, not being complete or
correct. A second try.

I am trying to create a formula that combines IF with
HLOOKUP. Example.
Cell a1 = 1, a2=10, a3=20; b1=2, b2 =12, b3=0 and so on
in row A. In D1 I have 1 in D2 I have the formula =IF
(HLOOKUP(D1,A1:A3,3)=0,(HLOOKUP(D1,A1:A3,3,(HLOOK UP
(D1,A1:A3,2))))). What I want the formula to do is
return the value in a3 if it is larger than 0 otherwise
return the value in a2. The problem I am having is that
it works fine if cell a3 is 0, but if cell a3 is 0 or
empty it returns 0 rather than 10.

Help is always appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default IF and HLOOKUP Formula

Hi
though it makes no sense in your example case try
=IF(HLOOKUP(D1,A1:A3,3,0)0,HLOOKUP(D1,A1:A3,3,0), HLOOKUP(D1,A1:A3,2,0)
)

But still hwy not use
=IF(A30,A3,A2)



--
Regards
Frank Kabel
Frankfurt, Germany


Ronbo wrote:
Sorry about the first request, not being complete or
correct. A second try.

I am trying to create a formula that combines IF with
HLOOKUP. Example.
Cell a1 = 1, a2=10, a3=20; b1=2, b2 =12, b3=0 and so on
in row A. In D1 I have 1 in D2 I have the formula =IF
(HLOOKUP(D1,A1:A3,3)=0,(HLOOKUP(D1,A1:A3,3,(HLOOK UP
(D1,A1:A3,2))))). What I want the formula to do is
return the value in a3 if it is larger than 0 otherwise
return the value in a2. The problem I am having is that
it works fine if cell a3 is 0, but if cell a3 is 0 or
empty it returns 0 rather than 10.

Help is always appreciated.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default IF and HLOOKUP Formula


-----Original Message-----
Sorry about the first request, not being complete or
correct. A second try.

I am trying to create a formula that combines IF with
HLOOKUP. Example.
Cell a1 = 1, a2=10, a3=20; b1=2, b2 =12, b3=0 and so on
in row A. In D1 I have 1 in D2 I have the formula =IF
(HLOOKUP(D1,A1:A3,3)=0,(HLOOKUP(D1,A1:A3,3,(HLOO KUP
(D1,A1:A3,2))))). What I want the formula to do is
return the value in a3 if it is larger than 0 otherwise
return the value in a2. The problem I am having is that
it works fine if cell a3 is 0, but if cell a3 is 0 or
empty it returns 0 rather than 10.

Help is always appreciated.

.
Frank:


Thanks alot for your help this time and the times
before. It is very much apprectiated. Your formula
works perfect. I need to use HLOOKUP because the lookup
criteria in A1 will not be the same next month, i.e. this
time it A1 is 1, next month it will be A1 will be 2, so
next month the formula in D1 has find the column the 1 is
in.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default IF and HLOOKUP Formula

"Ronbo" wrote:
Frank:


Thanks alot for your help this time and the times
before. It is very much apprectiated. Your formula
works perfect. I need to use HLOOKUP because the lookup
criteria in A1 will not be the same next month, i.e. this
time it A1 is 1, next month it will be A1 will be 2, so
next month the formula in D1 has find the column the 1 is
in.


If you are saying that next month A1 will be 2 and B1 will be 1 (and that you then want to return values from column B) then you should change the Range in the Hlookup to A1:B3.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hlookup and sum formula SixBowls Excel Discussion (Misc queries) 3 October 23rd 09 03:19 PM
IS THERE ANY FORMULA IN EXCEL THAT CAN DO THIS? HLOOKUP MAYBE? HERNAN Excel Discussion (Misc queries) 1 June 19th 09 03:20 PM
HLOOKUP Formula Error albert Excel Worksheet Functions 1 March 10th 08 04:04 PM
array formula with if and hlookup bport jim Excel Worksheet Functions 5 January 8th 07 03:26 AM
formula using both vlookup & hlookup xFreeAdvice Excel Worksheet Functions 2 November 17th 04 11:19 PM


All times are GMT +1. The time now is 08:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"