|
|
 |
Joined: 12/28/2010
Posts: 3
|
|
|
Hi All ..
I think the below data explains my problem very clearly.
I hav used DGet function one a ell and succesfully retrived the value from the database (price - 400 ).
How can I extend the formula to the next row cell ???? Pls Help
|
INPUT DATA
|
|
|
|
|
|
OUTPUT DATA
|
|
|
|
|
Part no.
|
Part
|
Operation
|
Price
|
|
|
|
Part no.
|
Part
|
Operation
|
Price
|
|
|
ABC
|
Male
|
TRUE
|
400.00
|
|
|
|
ABC
|
Male
|
TRUE
|
400.00
|
DGET(INPUT,"Price",$H$2:J3)
|
|
ABC
|
Male
|
FALSE
|
350.00
|
|
|
|
ABC
|
Female
|
TRUE
|
#NUM!
|
DGET(INPUT,"Price",$H$2:J4)
|
|
ABC
|
Female
|
TRUE
|
200.00
|
|
|
|
ABC
|
Female
|
FALSE
|
#NUM!
|
DGET(INPUT,"Price",$H$2:J5)
|
|
ABC
|
Female
|
FALSE
|
125.00
|
|
|
|
ABC
|
Male
|
FALSE
|
#NUM!
|
DGET(INPUT,"Price",$H$2:J6)
|
Regards,
Sandhya T Ram
|
|
|
|
 |  |
|
|
|
Hi,
The DGET function will never give you the desired result when copied down. If you definitely want to use the Database functions of Excel, you may use the DSUM instead
=DSUM(input,"Price",$H$2:J3)-SUM(K$2:K2)
When you copy this formula down, you will get your desired result.
Hope this helps.
Do let me know how this works.
|
|
|
|
 |  |
|
|
 |
Joined: 12/28/2010
Posts: 3
|
|
|
Hi Ashish,
Thank you so much for your response, but i m afraid that the output is still the same.
For more clarity I hav uploaded the file. Pls do the needful.
Regards
Sandhya T Ram
|
|
|
|
|
 |  |
|
|
|
Hi,
There is some error in downloading the file. Please upload the file on some free file hosting server such as www.mediafire.com or Google Docs and then provide a link to the uploaded file as a response to this message.
Also, i cross checked my formula and the answers are correct.
|
|
|
|
 |  |
|
|
 |
Joined: 12/28/2010
Posts: 3
|
| |
 |  |
|
|
|
Hi,
The formula is DSUM and not DGET. Please change that and your output will be as desired.
Do let me know how this works.
|
|
|
|
 |  |
|
|
 |
|
Joined: 12/28/2010
Posts: 9
|
|
|
Hi,
I m very sorry for that carelessness . Its working exactly as desired. THANX LOADS.
I hav one more query : Is there any function for looping the rows till the condition is satisfied...may be like "WHILE LOOP" or "FOR LOOP" kind?
Pls help.
Regards
Sandhya T Ram
|
|
|
|
 |  |
|
|
|
Hi,
Thank you for replying. I am glad my solution worked. Please be specific about the MS Excel "looping" question
|
|
|
|
 |  |
|
|
 |
|
Joined: 12/28/2010
Posts: 9
|
|
|
Hi,
Usally we use macros when we need to use iterative statements (like for loop ,while do loop etc ....)
eg.
Dim i As Range
For Each i In Range("A1:A10") 'Any range
i.Value = i.Value + 1 'Block of code
Next i
Is there any build in funtion to perform this without using any macros????
|
|
|
|
 |  |
|
|
|
Hi,
Yes, the SUBTOTAL() function can loop.
|
|
|
|
 |  |
|
|
 |
|
Joined: 12/28/2010
Posts: 9
|
|
|
hi,
Thankx for that info.
But the issue is range of the cells to be looped ( selected for looping ) is based on one / multuple crietria.
So how and where do I define the crietria of the range to be seleted.
PLZ HELP...
Regards
Sandhya T Ram
|
|
|
|
 |  |
|
|
|
Hi,
As requested, please explain the MS Excel question very clearly. Just as you clearly articulated the DGET question, please explain this question as well.
|
|
|
|
 |  |
|
|
 |
|
Joined: 12/28/2010
Posts: 9
|
| |
 |  |
|
| |
 |  |
|
|
 |
|
Joined: 12/28/2010
Posts: 9
|
|
|
Hi,
With ref to looping issue xls file:
- A person can do any no. of job in a day but the the sumation of the jobs for a particular person on particular day has to be calculated .
- In this case I have to loop the n of rows where "n" is dynamic in nature based on no. of job done by a person on particular day.
- So, how and where do I define the critrea to select the n rows???? Which is dynamic in nature.??
with ref to your sol given:
IF(OR(COUNTA(C11:H11)=0,AND(C11=C12,D11=D12)),"",SUMPRODUCT((C$8:C11=C11)*(D$8:D11=D11)*(H$8:H11))-280)
above undelined are applicable only to the records having to loop only 2 rows....
|
2-Dec-10
|
ABC
|
job1
|
125
|
1.50
|
187.5
|
|
|
|
2-Dec-10
|
ABC
|
job2
|
145
|
2.00
|
290
|
|
197.5
|
|
2-Dec-10
|
xyz
|
job2
|
200
|
2.40
|
480
|
|
200
|
In this case databse was minimal ...so the comparision was simple...to loop 2 row ( fixed the loop for two by manually conclusion)
wat if the case is for "n" no of rows???? where n is dynamic?????????
|
|
|
|
 |  |
|
|
|
Hi,
You have not quoted a situation where my formula would yield an incorret resuly. I just changed the xyz to ABC. The solution was 677.5 in cell J12 (J10:J11 was blank).
Please bring up the case (like tyou did for the DSUM()), where my formula does not give the expected result.
For my formula to work person appearing for every date should all appear together i.e. the data should first be sorted by Date and then by Person
|
|
|
|
 |  |
|
|
 |
|
Joined: 12/28/2010
Posts: 9
|
|
|
Hi,
I tried adding records fro the same table u send (formula wat u sent is restored)
See the output......
|
Date
|
Person
|
Job
|
Qty
|
Price
|
Wage
|
|
My formula
|
|
|
|
|
|
|
|
|
|
|
1-Dec-10
|
XYZ
|
job1
|
200
|
1.00
|
200.00
|
|
-80.00
|
|
1-Dec-10
|
XYZ
|
job2
|
50
|
8.00
|
400
|
|
320.00
|
|
|
|
|
|
|
|
|
|
|
2-Dec-10
|
ABC
|
job1
|
125
|
1.50
|
187.5
|
|
-92.50
|
|
2-Dec-10
|
ABC
|
job1
|
145
|
2.00
|
290
|
|
197.50
|
|
2-Dec-10
|
XYZ
|
job2
|
200
|
2.40
|
480
|
|
200.00
|
|
2-Dec-10
|
XYZ
|
job2
|
200
|
2.40
|
480
|
|
680.00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4-Dec-10
|
XYZ
|
job4
|
100
|
1.00
|
100
|
|
-180.00
|
|
4-Dec-10
|
PQR
|
job4
|
150
|
1.50
|
225
|
|
-55.00
|
|
|
|
|
|
|
|
|
|
|
5-Dec-10
|
abc
|
job2
|
250
|
1.75
|
437.5
|
|
157.50
|
Regards
Sandhya T Ram
|
|
|
|
 |  |
|
|
 |
|
Joined: 12/28/2010
Posts: 9
|
|
|
Hi,
I tried adding records fro the same table u send (formula wat u sent is restored)
See the output......
|
Date
|
Person
|
Job
|
Qty
|
Price
|
Wage
|
|
My formula
|
|
|
|
|
|
|
|
|
|
|
1-Dec-10
|
XYZ
|
job1
|
200
|
1.00
|
200.00
|
|
-80.00
|
|
1-Dec-10
|
XYZ
|
job2
|
50
|
8.00
|
400
|
|
320.00
|
|
|
|
|
|
|
|
|
|
|
2-Dec-10
|
ABC
|
job1
|
125
|
1.50
|
187.5
|
|
-92.50
|
|
2-Dec-10
|
ABC
|
job1
|
145
|
2.00
|
290
|
|
197.50
|
|
2-Dec-10
|
XYZ
|
job2
|
200
|
2.40
|
480
|
|
200.00
|
|
2-Dec-10
|
XYZ
|
job2
|
200
|
2.40
|
480
|
|
680.00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4-Dec-10
|
XYZ
|
job4
|
100
|
1.00
|
100
|
|
-180.00
|
|
4-Dec-10
|
PQR
|
job4
|
150
|
1.50
|
225
|
|
-55.00
|
|
|
|
|
|
|
|
|
|
|
5-Dec-10
|
abc
|
job2
|
250
|
1.75
|
437.5
|
|
157.50
|
Regards
Sandhya T Ram
|
|
|
|
 |  |
|
|
|
Hi,
There is something wrong you are doing. I have uploaded the file with my solution - see column M of sheet named "Looping issue".
Please check and let me know.
|
|
|
|
|
 |  |
|
|
 |
|
Joined: 12/28/2010
Posts: 9
|
|
|
Hi Ashish,
Very Sorry for late reply....As I was researching your formula and sloving methodology.....I
was completely lost and forgot to reply ontime.....First of all Thanx Million :) ....
could u pls suggest me any sites to look for such solving methodology or explaining such logics???
Regards
Sandhya T Ram
|
|
|
|