[Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register]

Author Message
AndrewHuggan
Newbie

Joined: 19 Dec 2010
Posts: 4

 Posted: Sun Dec 19, 2010 11:15 am    Post subject: [SOLVED] If Range Contains, then this value Hiya folks, I have been trying to do this for a while and been googling for answers but just cant seem to get it right. I have a spreadsheet where I am keeping track of my CD sales. I want the spreadsheet to workout the paypal charges automatically, depending on wheather or not the address is in the uk. For example: IF the addres contains "United Kingdom" (cell range H2:L2) then Paypal Charge (U2) = Total amount (T2) * 3.4% (X2) + 0.2 IF the addres does not contain "United Kingdom" (cell range H2:L2) then Paypal Charge (U2) = Total amount (T2) * 3.4% (X3) + 0.2. I tried using the IF function, the HLOOKUP function and the LOOKUP function but I just dont seem to be able to get it right. Here is the formula I thougtht should work but doesnt: =IF(LOOKUP("United Kingdom";H2:L2);(T2*X3)+0.2;(T2*X2)+0.2) Any ideas where I am going wrong?Last edited by AndrewHuggan on Tue Dec 21, 2010 11:02 am; edited 2 times in total
Villeroy
Super User

Joined: 04 Oct 2004
Posts: 10065
Location: Germany

 Posted: Sun Dec 19, 2010 11:32 am    Post subject: No, LOOKUP is the totally wrong function. Calculate the products for all the rows and then use http://wiki.services.openoffice.org/wiki/Documentation/OOo3_User_Guides/Calc_Guide/DataPilot Using a database this would be a matter of one minute for millions of rows._________________Rest in peace, oooforum.org Get help on http://forum.openoffice.org
AndrewHuggan
Newbie

Joined: 19 Dec 2010
Posts: 4

 Posted: Sun Dec 19, 2010 11:51 am    Post subject: I don't understand. If I were to calculate them all manually it would defeat the purpose of calc working it out automaticall.
Villeroy
Super User

Joined: 04 Oct 2004
Posts: 10065
Location: Germany

 Posted: Sun Dec 19, 2010 12:52 pm    Post subject: Anyhow, it would be worth the time and money if you'd buy some old Excel book from the flea market. No, LOOKUP does not work like this and never did in any application. http://www.oooforum.org/forum/viewtopic.phtml?t=104524&start=0&postdays=0&postorder=asc&highlight=match+lookup http://www.oooforum.org/forum/viewtopic.phtml?t=98700&start=0&postdays=0&postorder=asc&highlight=match+lookup [this is how LOOKUP is supposed to work] http://www.oooforum.org/forum/viewtopic.phtml?t=94248&highlight=match+lookup http://www.oooforum.org/forum/viewtopic.phtml?t=79596&highlight=match+lookup http://www.oooforum.org/forum/viewtopic.phtml?t=57670#228451_________________Rest in peace, oooforum.org Get help on http://forum.openoffice.org
AndrewHuggan
Newbie

Joined: 19 Dec 2010
Posts: 4

 Posted: Sun Dec 19, 2010 5:04 pm    Post subject: So what WOULD work?
ken johnson
Super User

Joined: 23 Apr 2009
Posts: 1846
Location: Sydney, Australia

Posted: Sun Dec 19, 2010 7:34 pm    Post subject:

Maybe...
 Code: =IF(ISNUMBER(MATCH("United Kingdom";H2:L2;0));(T2*X3)+0.2;(T2*X2)+0.2)

Ken Johnson
_________________
AndrewHuggan
Newbie

Joined: 19 Dec 2010
Posts: 4

 Posted: Tue Dec 21, 2010 11:01 am    Post subject: That worked perfectly! Thank you so much Ken!
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT - 8 Hours Page 1 of 1

 Jump to: Select a forum OpenOffice.org Forums----------------Setup and TroubleshootingOpenOffice.org WriterOpenOffice.org CalcOpenOffice.org ImpressOpenOffice.org DrawOpenOffice.org MathOpenOffice.org BaseOpenOffice.org Macros and APIOpenOffice.org Code Snippets Community Forums----------------General DiscussionSite Feedback
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum