OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

[SOLVED] If Range Contains, then this value

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
AndrewHuggan
Newbie
Newbie


Joined: 19 Dec 2010
Posts: 4

PostPosted: Sun Dec 19, 2010 11:15 am    Post subject: [SOLVED] If Range Contains, then this value Reply with quote

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
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10065
Location: Germany

PostPosted: Sun Dec 19, 2010 11:32 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
AndrewHuggan
Newbie
Newbie


Joined: 19 Dec 2010
Posts: 4

PostPosted: Sun Dec 19, 2010 11:51 am    Post subject: Reply with quote

I don't understand. If I were to calculate them all manually it would defeat the purpose of calc working it out automaticall.
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10065
Location: Germany

PostPosted: Sun Dec 19, 2010 12:52 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
AndrewHuggan
Newbie
Newbie


Joined: 19 Dec 2010
Posts: 4

PostPosted: Sun Dec 19, 2010 5:04 pm    Post subject: Reply with quote

So what WOULD work?
Back to top
View user's profile Send private message
ken johnson
Super User
Super User


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

PostPosted: Sun Dec 19, 2010 7:34 pm    Post subject: Reply with quote

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

Ken Johnson
_________________
If your problem has been solved please add "[Solved]" to the beginning of your first post title (edit button).
Back to top
View user's profile Send private message
AndrewHuggan
Newbie
Newbie


Joined: 19 Dec 2010
Posts: 4

PostPosted: Tue Dec 21, 2010 11:01 am    Post subject: Reply with quote

That worked perfectly! Thank you so much Ken!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group